5

So, I have a windows service which can have multiple instances installed on a single server. The installer needs to be able to upgrade a single instance. The installer uses Instance Transforms, but I am unsure how to get major upgrades working as I would like.

For a major upgrade to work, my understanding is that I should have the Product Code change, so instances are defined in this form:

<Instance ProductCode="*"
            UpgradeCode="{SOMEGUID}"
            ProductName="Instance 1"
            Id="Instance1"/>

The msi can be launched to install a new instance by:

msiexec.exe /i "installer.msi" TRANSFORMS=:Instance1 MSINEWINSTANCE=1

However, after much searching the only way I have found to run an upgrade on a specific instance is this format:

msiexec.exe /i "installer.msi" /n {PRODUCTCODE} REINSTALL=ALL REINSTALLMODE=vamus

The problem with this is if the product code is autogenerated for major upgrades, then I don't know what it is, so I can't pass in to the command arguments.

Is there a way to launch an upgrade using the Instance's UpgradeCode or InstanceID instead or ProductCode? Since both of those will stay static. Alternatively, can I launch the msi with no arguments, pick an existing instance (via checking registry) in the UI dialog, and set appropriate properties to force the msi into upgrade mode for that instance?

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
AndyK
  • 298
  • 1
  • 3
  • 9
  • You might find this helpful: http://sklyarenko.net/blog/2011/09/14/revisited-multiple-instance/ – Yan Sklyarenko Apr 04 '14 at 11:20
  • It seems to me that once each of the instances is installed, it's a product with a productcode. If you're doing an upgrade, then your new product just needs to do a boring major upgrade and populate its upgrade table with the stuff that will replace whatever previous product it should replace. Not that I know a lot about instances, but have you tried the conventional approach of using upgrade tables that cause your new instance to upgrade each of your old instances. Are you saying that you cannot upgrade each product individually because they all share the same upgradecode? Same version? – PhilDW Apr 06 '14 at 19:12
  • Just to let you know that you can get a **full list** of **product codes**, **upgrade codes** and **product names** on a given machine via PowerShell: [**How can I find the Upgrade Code for an installed MSI file?**](https://stackoverflow.com/questions/46637094/how-can-i-find-the-upgrade-code-for-an-installed-msi-file/46637095#46637095). – Stein Åsmul Oct 11 '17 at 16:01

2 Answers2

8

Pretty sure you need the product code for this since the upgrade code identifies a family of products, and not a single one.

Fire up PowerShell and run this command to get a list of installed products with product code:

Get-WmiObject -Class win32_product

Here is a different way to get the output in a tabular format (IdentifyingNumber is ProductCode):

Get-WmiObject Win32_Product | Format-Table IdentifyingNumber, Name, Version

You can also find the product code in the Property table of the compiled MSI using Orca (MSI SDK tool):

enter image description here

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
1

Here is what I've done so far to handle 3 separate instances upgrading:

<InstanceTransforms Property="Upgrade">
  <Instance Id="I01" ProductCode="*"  ProductName="Product Instance 1" UpgradeCode="55a25a09-5979-438d-91dd-67755012a288"/>
  <Instance Id="I02" ProductCode="*" ProductName="Product Instance 2" UpgradeCode="a27eb2e5-9aa8-4d09-b6c0-df717875c310"/>
  <Instance Id="I03" ProductCode="*" ProductName="Product Instance 3" UpgradeCode="d705720d-3703-4b17-817e-bd51edd9abea"/>
</InstanceTransforms>

While my Property Upgrade is a fixed Guid. With this, I can handle 3 instances with their updates separately using this line -for new installs, add MSINEINSTANCE=1- :

msiexec /i MyProduct.msi MSINEWINSTANCE=1 Transforms=":I01"

makertoo
  • 166
  • 1
  • 11
  • This is more or less exactly what I ended up doing. I can't say for sure if it would've worked at the time the question was opened, but wix multi instance support has come a long way since then and it certainly does work now. – AndyK Mar 05 '18 at 11:40