Conditional installation path based on target OS

456 Views Asked by At

I am creating a visual studio set up project to be installed on XP, Vista and Windows 7. In order for my program to be installed successfully on Vista and Seven, it needs to be installed in:

c:\ProgramData

I pointed the installation path of Application Folder as follow default location:

[CommonAppDataFolder][Manufacturer]\[ProductName] 

and as the condition I put:

VersionNT>=600

However, I want my program to be installed in:

c:\programfiles\Manufacturer

... for XP. I added a special folder which was pointing to ProgramFilesFolder and in the condition I put:

VersionNT<600

However it seems this condition is not being checked and it always tries to install in *C:\Documents and Settings\All Users\Application Data\mySoftware* for XP.

I am not sure if I am missing anything here. I really appreciate any help and suggestion.

1

There are 1 best solutions below

0
On BEST ANSWER

This is not supported by Visual Studio setup projects, but it can be done with other setup authoring tools. The general approach is this:

  • create a type 51 custom action (property set with formatted text)
  • schedule it before CostInitialize action in InstallUISequence
  • configure it to set your installation folder property to the custom XP installation folder
  • condition this action to run only on XP

This way your package will use the Windows 7 install path by default and the XP path only when your custom action is executed.