Wednesday, March 19, 2014

Registering .Net Dlls' for use in VB6 32 applications

You have that legacy application that is not willing to go away and you need to use functionality from code you created in .Net.

You need to register the dll for VB6 to be able to find it.

Best thing to do is to create a batch file with the following code:

1) Make the call from you application folder, so you need to move your cursor to that folder
2) Unregister the dll - this is really important as windows registry can get really messy and totally confused if you have multiple versions of the same dll
3) Register the new dll. NOTE: Use the /codebase switch otherwise it just won't happen

Here is the batch file code:

cd C:\Program Files\YourApplication\
C:\windows\microsoft.net\framework\v2.0.50727\Regasm.exe /u YourNewcode.dll
C:\windows\microsoft.net\framework\v2.0.50727\Regasm.exe ReportLogic.dll /codebase

If your application is used by multiple users, you can add code to run the batch file when users load your application.

No comments: