I have created a strongly signed assembly in Visual Studio 2008 against the .NET 3.5 framework (I tried 2.0 framework as well). I exposed a class as COM visible, and I am able to find this dll in the object browser of Visual Studio 6 for Visual Basic. I can create an exe in VB6 and run that exe directly from windows explorer, and everything works fine. However, when I try to run the VB6 project inside Visual Studio 6 the .net assembly doesn't want to load and fails with the following error:
ActiveX component can't create object
I also get this error instead of the one above, depending on how I register the dll:
-2147024894 File or assembly name (myComponentName), or one of its dependencies, was not found.
Or this:
-2146233082 Automation error
I have tried everything I can think of. It seems that this would be a problem with the way VS6 runs in debug mode. Maybe the environment is different with a missing path to this or another dll. I have this problem on two different development machines. I can also reference a COM .net dll that was built by another developer using an older version of visual studio .net. I even opened the dll with dependency walker and I didn't get any obvious errors.
UPDATE: Proc monitor is saying that VB6 is looking for my dll in the vb6 studio home directory "C:\Program Files\Microsoft Visual Studio\VB98\MyDLL.DLL" instead of where the DLL is registered. I placed the dll there and registered it, now I'm getting a new error:
-2146234105 (80131107) "The format of the file 'MyDllName' is invalid."
So, why is studio looking for my DLL there and not where it's registered? How can I fix that? At the very least, how can I get the dll to work in the "C:\Program Files\Microsoft Visual Studio\VB98\" folder
Final Update/SOLUTION: Ok, so I figured out the problem. This has to do with VB6.exe being locked out of the .net framework version I was using (2.0 or 3.5). I found this file "C:\Program Files\Microsoft Visual Studio\VB98\vb6.exe.config" that contained the following entry:
<configuration>
<startup>
<supportedRuntime version="v1.1.4322" />
</startup>
As soon as I removed this file the dll started working fine from the visual studio 6 environment. Thanks to everyone who responded to help.