View Full Version : newbie: regasm problems

06-13-2004, 09:28 AM
I'm having problems with registering a .NET DLL to be used by COM clients. This DLL depends onto other DLL's and all these are installed into the GAC, too. The DLL which is to be used by COM clients is marked for COM interop registration in my installscript installation, but this is not enough to have it completely registered, as I could see also from other posts (will this ever be fixed??). If I manually run regasm after my installation has run all works fine, so I tried to launch regasm in the script itself as follows:

1) I have created a handler for OnFirstUIAfter in my script.

2) I have added regasm.exe to the installation files to that it is copied to the target directory during install and I can find and launch it.

3) I have added the following code (let's say the DLL to be registered is called Dummy and its version and key are as in the sample below):

// first unregister any previous Dummy
LaunchAppAndWait(INSTALLDIR ^ "regasm.exe",
WINDIR ^ "assembly\GAC\Dummy\" ^
"Dummy.dll /unregister", LAAW_OPTION_WAIT);

// now register the new version
LaunchAppAndWait(INSTALLDIR ^ "regasm.exe",
WINDIR "assembly\GAC\Dummy\" ^
"Dummy.dll /tlb:Dummy.tlb", LAAW_OPTION_WAIT);

// delete the REGASM temporarily copied for these operations
DeleteFile(INSTALLDIR ^ "regasm.exe");

Now, apart from the fact that I still need to unregister when uninstalling, this code does not work: regasm is launched (I can see the "DOS" window) but it does not succeed as the application does NOT work (the DLL appears in the COM list but its types are not registered). If I then execute the same REGASM commands from a command prompt it works fine, while the SAME command issued from within the installation program does not work.

So how can I:
- let my installation correctly and fully register my DLL?
- perform a corresponding uninstall?

Thanx to all!

06-14-2004, 11:12 AM
2 suggestions:

(1) Use the LAAW_PARAMETERS.nLaunchResult value to see what the regasm execution return code is. If you don't know what it means, post it in this thread and you will probably receive more help.

(2) Create a batch file (.bat) and insert the regams command on one line, then insert another line with only @pause on it. Execute that batch file instead of regasm directly. This will keep the DOS window open until you hit a key. You will then be able to see the error code returned by regasm before continuing with the installation.

Good luck.