Using Wisecomcapture is always the best option to use when registering a DLL. See this article for some background.
But, if there is a case when the DLL doesn't exist in the package and there is a necessity to register a file manually, this tip should prove handy.
To manually register a .DLL using regsvr32.exe in a .MSI package:
Step 1: Go to MSI Script in the WSI project. Add an Execute Program from Destination custom action after InstallFinalize in the Execute Immediate tab. The Execute Program From Destination dialog appears.
Step 2: Fill in the following information: Custom Action Name: <registerdll> Working Directory: Enter SystemFolder EXE and Command Line: Enter the full path to regsvr32.exe and the full path to .DLL. Example: [SystemFolder]regsvr32.exe [WindowsFolder]123.DLL
Step 3: Accept all other defaults and click OK.
Ensure that the custom action has a condition around it so that it only executes when the installation is getting placed on the computer:
If Not Installed Execute Program from Destination End Statement
Thanks to all of the above, has helped me solve my problem with registering dlls.
My next question around this same topic is how do you replace an existing dll with a newer version in e.g. C:\Windows\System32\test.dll.
When installing my new package it still showing the old dll and not the new one.
Any help would be appreciated.
Y
Thanks a ton for this post. I tried several methods (by using batch files and deferred exection script) but ultimately your solution worked flawlessly.
I would like to add one thing though, the path to the dll must be enclosed in double quotes:
Suppose that after installation, the path to dll to be registered is C:\Program Files (x86)\myApp\bin\xyz.dll then the command line entry should be:
[SystemFolder]regsvr32.exe /s "[ProgramFilesFolder]\myApp\bin\xyz.dll"