0

How can I dynamically set my product name in my product.wxs file?

My idea was to create a custom dialog where the user can choose between either 2015, 2016 or 2017 via radio buttons. The year is supposed to be the suffix for my product name:

 <Product Id="*"
          Name="BlaBla 2015"
          Language="1033"
          Version="$(var.SomePluginVersion)"
          Manufacturer="MyCompany"
          UpgradeCode="{SOME-GUID}">

I guess the custom dialog has to set a preprocessor variable so the product name can be defined before the actual installation process. But how would I do that?

1 Answers1

1

ProductName is a property, you can just set it to any value you want dynamically. For example:

<Property Id="Year">2016</Property>

<CustomAction Id="SetProductName" Property="ProductName" Value="Product [Year]" />
<InstallExecuteSequence>
  <Custom Action="SetProductName" After="InstallInitialize"/>
</InstallExecuteSequence>
Nikolay
  • 10,752
  • 2
  • 23
  • 51
  • Wow that was easier than I expected. Having some difficulties in WiX every now and then because I'm not used to the syntax, yet. Thanks so much, Nikolay. –  Apr 26 '16 at 06:21
  • Yep, the syntax is a bit creepy, but that's basically not WiX but windows installer design issue.. – Nikolay Apr 26 '16 at 07:33
  • Yes I tend to mix them up quite often. Thanks again. –  Apr 26 '16 at 07:41
  • Always useful to take a look at your MSI with Orca and look at the database tables or decompile an msi with Dark to see how to do something with Wix – Brian Sutherland Apr 26 '16 at 14:26
  • This does not work for me. In my case the name remains Name="BlaBla 2015". Any suggestion will be welcomed. Thank you. – Alexandru Dicu Jan 17 '20 at 21:45