How to unregister then reregister file during install

Article:HOWTO6328  |  Created: 2005-10-18  |  Updated: 2010-06-22  |  Article URL http://www.symantec.com/docs/HOWTO6328
Article Type
How To



Question
How would I unregister a .DLL and then reregister it during installation?

Answer

In the Windows Installer Editor of Wise Package Studio or Wise for Windows Installer:

  1. Open the Setup Editor.
  2. Select the Tables tab
  3. Click on the File table and locate the .DLL you are trying to register. Note of the component name listed in the component column for that file.
  4. Click on the Component table and find the component. Note of the directory name listed in the Directory_ column for that component. The instructions below assumes that this value is INSTALLDIR.

In the MSI Script, follow the steps below:

  1. In the Execute Immediate sequence, add a Execute Program from Destination custom action after InstallFinalize. The Execute Program from Destination dialog appears.
  2. Fill in the following information:

    • Custom Action Name: UnregisterDLL
    • Working Directory: Browse for System32
    • EXE and command line: [SystemFolder]Regsvr32.EXE /U "[INSTALLDIR]TEST.DLL"

  3. Click OK.
  4. Add a second Execute Program from Destination custom action immediately after UnregisterDLL. The Execute Program from Destination dialog appears.
  5. Fill in the following information:

    • Custom Action Name: RegisterDLL
    • Working Directory: Browse for System32
    • EXE and command line: [SystemFolder]Regsvr32.EXE "[INSTALLDIR]TEST.DLL".

  6. Click OK.
  7. Add an If Statement right before the UnregisterDLL custom action. The If Settings dialog appears.
  8. Enter "NOT Installed" in the Condition field.
  9. Click OK.
  10. Add an End statement after the RegisterDLL custom action.

The new actions should appear after InstallFinalize in the Execute Immediate tab as shown below:

If NOT Installed then
   Execute Program From Installation (UnregisterDLL)
   Execute Program From Installation (RegisterDLL)
End


Legacy ID



3168


Article URL http://www.symantec.com/docs/HOWTO6328


Terms of use for this information are found in Legal Notices