Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
606 views
in Technique[技术] by (71.8m points)

installation - WiX - Doing a major upgrade on a multi instance install

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...