I have a DLL I wrote in C# which I want to use in my VB6 application.
In VS2008 the project property "Register for COM interop" is checked, and when I compile the DLL and try to use it on my development machine - it runs ok.
I need to run it on a computer which does not have VS2008, so I tried to register this DLL like so:
C:\WINDOWS\system32>..\Microsoft.NET\Framework\v2.0.50727\regasm myDLL.dll /tlb: myDLL.tlb /codebase
but then when I try to run it I get this error:
Automation Error. The system cannot find the file specified.
Can anybody tell me what I'm doing wrong?
You can run a command-line tool called the Assembly Registration Tool (Regasm.exe) to register or unregister an assembly for use with COM. Regasm.exe adds information about the class to the system registry so COM clients can use the . NET Framework class transparently.
Using the Code In Visual Studio, create a new Class Library project. In the project Properties, click on the Application tab, click on the Assembly Information button, check the option Make assembly COM-Visible. In the Build tab, check the option Register for COM interop. Add a new class CSharpInteropService.
You asked: "I created a c# dll project under Visual Studio 2010, with several public classes, and I would like to use its classes inside another dll project, but written in vb.net." YES you can do it. Just add to that DLL reference and that's it!
By dragging and dropping the dll onto 'regasm' you can register it. You can open two 'Window Explorer' windows. One will contain the dll you wish to register. The 2nd window will be the location of the 'regasm' application.
Just like you specified the full path to regasm.exe, you need to specify the full path to your .dll ;-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With