smallest
Posts: 8
Joined: Mon Jul 14, 2008 2:20 am

Conditional Install Location

Hi,

I'm making an MSI for a set of plugin DLLs. The issue is that these files need to go into one of two different folders based on the contents of a Registry key (which may or may not be there). Basically the reg key contains the version of the plugin host application, and older versions expect the plugins to be in a different place than newer versions do.

Is there a way to do this ?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Conditional Install Location

Hi,

This can be done by using a property-based folder and two custom actions:
- go to the Install Parameters page and create a custom property
- set its value to a valid path (for example "C:\")
- go to the Files and Folders page and create a property-based folder by using the custom property
- add your files into this folder
- go to the Search page and create a new search
- set the location of the search to your custom registry entry
- go to the Custom Actions
- use the "Show Standard Action" button on the toolbar to show the "InstallExecuteSequence" -> "RemoveFolders" standard action
- under "RemoveFolders" create two "Directory set with Formatted" custom actions
- configure these custom actions to set the path of your property-based folder
- the conditions of these custom actions should be based on the property of the registry search you created

Basically, the package will search for your custom registry entry and it will store the result into an installer property. This property will then be used by the two custom actions to determine which custom action will set the final path of the property-based folder.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”