1



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.

Purohit Hitesh
  • 1,018
  • 16
  • 28
  • Product name can be supplied from command line . I referred to this answer https://stackoverflow.com/a/15085936/5024215 and found that there was mistake in my defined constant in .wixproj file. – Purohit Hitesh Dec 26 '18 at 08:44
  • 1
    _"multiple version installed of same product"_ -- in addition to installation directory, you also have to change all component GUIDs to avoid breaking component rules. – zett42 Dec 27 '18 at 22:42
  • @zett42 from your comment, I can anticipate a big problem coming towards me because I haven't changed component GUIDs. could you please elaborate or point me to any resource, so that I can understand what probably could go wrong If i do not change component GUIDs. – Purohit Hitesh Dec 28 '18 at 05:35
  • 1
    In this case, the biggest problem would be incomplete uninstall. Only the 1st uninstallation would remove its files and registry keys, the next ones would be broken. Official Reference: [Organizing Applications into Components](https://learn.microsoft.com/en-us/windows/desktop/msi/organizing-applications-into-components) (also see links at bottom of this page). – zett42 Dec 28 '18 at 08:05
  • 1
    A greate resource is the blog of Rob Mensching, author of the WiX toolset: [Windows Installer Components Introduction](http://robmensching.com/blog/posts/2003/10/4/windows-installer-components-introduction/), [Component Rules 101](http://robmensching.com/blog/posts/2003/10/18/component-rules-101/) – zett42 Dec 28 '18 at 08:08
  • @zett42 Many Thanks for above references. I have gone through all links. I am convinced that it is require to have separate bunch of component ID for each product version. say if I have alpha, beta or production I need to have 3 different set of GUIDs or Comp Ids. This means I have to harvest it for as many as times as number of builds. – Purohit Hitesh Jan 30 '19 at 10:03
  • 1
    Correct. As a rule of thumb, files that will be installed in different locations, must have different component **GUIDs**. If you have some shared files that are installed in the same location by different setups, these must have the same component GUIDs in all setups. The component ID doesn't matter, it only needs to be unique within the same setup. – zett42 Jan 31 '19 at 09:01

0 Answers0