Ever needed to know what registry entries are required to register a COM DLL? Well I did recently.

Sometimes you get caught out with Visual Studio Setup Projects (well that’s if you’re still using VS 2010 – bring back Setup Projects in VS Microsoft!) copying referenced DLLs locally and registering them by default. This often happens with WorkSite or Office addins.

I had an issue the other day where I updated a setup project and removed a reference for a particular DLL that I was having to change to use late binding instead (long story!)

Once I removed the reference and the DLL was no longer part of the install, when the upgrade ran the removal of the previous version unregistered this particular DLL, which then broke another application as the DLL in the original location is no longer registered (as it was overwritten by the local copy in your installer)

Well to get around the problem I needed to re-register the DLL as part of the install process for the new version. After much experimentation I decided it was easiest to simply add the registry entries for the DLL to the new installer.

This is where I came across a handy util that is part of Visual Studio – regcap. With Regcap you can find out what registry values are added when you register a DLL.

Just run regcap with the /o command and the name of the reg file you want to create, plus the name of the DLL you want to capture, as per the example below (the names of the actual DLL have been changed to protect the innocent – actually more likely to protect the guilty!)

C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\Deployment>regcap /o c:\SomeAppDLL.reg “C:\Program Files\SomeApp\SomeAppExtension.dll”

Interestingly I had problems running this application on Windows 7 for this particular DLL. I tried several suggestions like setting compatibility mode for regcap, running as admin etc, but nothing worked for me. To get around the issue I copied the DLL to another dev machine running Windows Server 2003, and regcap worked a treat. I then imported the reg file that was created in the installer for my app, and problem solved.

© Copyright - DocAssist 2019