Simon Harriyott

Installer setup project not registering COM DLLs

I'm current using Visual Studio 2005 beta to create an installer which contains both .NET assemblies and a Delphi COM DLL. Reading the documentation, the DLL can be registered during installation by setting its Register property to vsdrfCOM. Unfortunately, when building the installer, the following warning appears:

Unable to create registration information for file named 'Component.dll'

(As an aside, this should really be an error, as the component isn't registered when the installer runs.) I did what everyone does with an error message, and pasted it into the Google. There were only a few results, some of which were duplicates, and none of which were helpful.

So I did what everyone else does, and randomly tried the other settings: vsdrfCOMSelfReg caused the warning to disappear, but caused errors when the installer ran. So I set it back to vsdrfDoNotRegister, which (clearly) didn't register the DLL after installing it.

So, back to basics. I checked that the DLL would actually register with regsvr32, and it did. The next logical step would be to write a batch file to run regsvr32 on the component as a custom action in the installer. Upon adding a custom action, I found that the only actions that can be added are .exe, .dll, .vbs and .js files. VBScript seemed the easiest, so I wrote a script that called regsvr32 through a shell object:

Dim WshShell
Set WshShell = CreateObject("Wscript.Shell")
WshShell.run "regsvr32 /s Component.dll"
Set WshShell = nothing

and added this to the Install section of the of the custom actions. I did the reverse (using the /u regsvr32 flag) and added this to the Uninstall section. This works, but the .vbs files are deployed with the application. It's a bit messy, but it's the first thing that works. Ideally, Visual Studio would understand the DLL, and maybe it does it the RTM version.
1 December 2005