To be short and precise, I built a C # class library that is COM visible and registered for COM Interop. I put together a library that led to the generation of DLL files and .tlb files.
I have another machine that runs the VB6 application. So, I copied the .dll and .tlb files to the C: / Windows / system32 folder on the computer. Then I registered these files using the following:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm C:\Windows\system32\TestClass.dll /tlb:TestClass.tlb
After the files were successfully registered, I added the project link to the Test.tlb file from my VB6 application, and then tried to call the method in my new reference class as follows:
Dim myObject As TestNamespace.TestClass Set myObject = New TestNamespace.TestClass MsgBox (myObject.TestMethod())
This does not work and I get Automation -2147024894 error.
I read that I should not install the dll in a private folder such as system32. I must either register with the GAC, or I must register elsewhere using the "/ codebase" option:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\RegAsm C:\TestClass.dll /tlb:TestClass.tlb /codebase
Is there a reason I should not use system32? The previous developers who worked on this project put the build files used by this VB6 project into system32 and there were no problems.
When I register my dll at the location of system32, I get an Automation error message. When I register my dll elsewhere (i.e. C: /), the method call to my class library from VB6 works as expected. What gives?
I should mention that we will NOT use the GAC to register DLLs. It is as it is.
Any help is appreciated.
Mike
source share