WIX Change Product Name and Install directory from command line parameters

1.1k Views Asked by At



I ran into a typical scenario where it required to change product name as supplied from command line parameters as below

MSBuild.exe ApplicationSetup.wixproj /p:AssemblyTitle=%USER_SPECIFIED_NAME% /p:ProductVersion=%VERSION% /p:ProductCode=%PRODUCT_CODE% /p:UpgradeCode=%UPGRADE_CODE% /t:Clean;Rebuild"


I am using those supplied parameters in .wxi file. as below :

 <Product Id="$(var.ProductCode)" Name="$(var.AssemblyTitle)" Language="4"
           Version="$(var.BuildVersion)"
           Manufacturer="!(loc.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">

This code compiles successfully. But the name of product in add/remove program is not reflecting correctly. I read that Product name cannot be supplied directly, it should be hard coded.Please advise on this.

Another typical requirement is to have multiple version installed of same product on a machine. I somewhat achieved this by doing following change in Product tag in .wxi file

  <Product Id="*" Name="$(var.AssemblyTitle)" Language="4"
            Version="$(var.BuildVersion)"
            Manufacturer="!(loc.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">



Now here come the issue that second installation will overwrite the file generated during first installation. So it is required to change install directory dynamically.

I have posted this after struggling for couple of days and tried many solution, but all in vain. Any help will be highly appreciated.

0

There are 0 best solutions below