How to Manually Register a DLL in an MSI
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
re: How to Manually Register a DLL in an MSI
You should of course want to add the silent switch to the command line otherwise the command will not end until the OK button has been pushed.
Example: [SystemFolder]regsvr32.exe /s [WindowsFolder]123.DLL
API DllRegisterServer and API DllUnRegisterServer
Just for info
To call the system API DllRegisterServer to self-register modules passed on the command line
one can use
msiexec /y
Parameters
/y : Calls the system API DllRegisterServer to self-register File passed on the command line.
->This option is used only for registry information that cannot be added using the registry tables of the .msi file.
Examples
The following example shows how you can use the msiexec /y command:
msiexec /y file_name.dll
To call the system API DllUnRegisterServer to unregister modules passed on the command line
One can use
Syntax
msiexec /z
Parameters
/z : Calls the system API DllUnRegisterServer to unregister file passed on the command line.
-> This option is used only for registry information that cannot be added using the registry tables of the .msi file.
Examples
The following example shows how you can use the msiexec /z command:
msiexec /z file_name.dll
Regards
Harsh
Truee...
Thats a nice addin Angel. I just understand the consequences now.. :D
Microsoft MVP [Setup-Deploy]
Weblog: www.msigeek.com
Can anyone let me know the
Can anyone let me know the difference between using regsvr.exe or msiexec.exe to do this?
Is there are reason to use one method over another?
thanks
self register
MSIEXEC /Y and /Z is one method of self registartion. This is one option provided by Windows Installer technology and entries get populated in selfreg table.
If you are using wise package studio, right click on file can see self register option. If you check this option, custom actions for MSIEXEC automatically get added in to your package, and selfReg table updated with the associated entries.
else you can enter file and cost value for required table entry record using tables.
I personally never recommend self-registration of DLLs or OCXs. I always recommend extracting COM information and populating the appropriate MSI tables. This entries can be seen in advertise tables viz ProgID, MIME , ClassID etc.
As per my experience, It is really difficult for me to find out the source of the registration issue. If running manually works then you can try creating a custom action to call regsvr32.exe with /s and pass your full path to the self registrable file command-line.
So Register using Regsvr32 is one of the trouble shooting methodology.
Hope this will helpful, let me know if require more input.
Cheers Festive season
Harsh
Would you like to reply?
Login or Register to post your comment.