Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uninstall shortcut in WiX when Product Id is * to allow major upgrades?

I was following the tutorial here to implement an uninstall shortcut in the start menu.

In short, the way to create the uninstall entry is as follows:

 <Shortcut Id="UninstallProduct"             
           Name="Uninstall My Application"
           Target="[SystemFolder]msiexec.exe"
           Arguments="/x [ProductCode]"
           Description="Uninstalls My Application" />

Based on Rob Mensching's suggestion here, if the application is small enough and you don't need to handle small updates and minor upgrades (which I don't), you can force every update to be a major upgrade. This is shown here. I used Rob's suggestion which was this:

<Product Id="*" UpgradeCode="PUT-GUID-HERE" Version="$(var.ProductVersion)">
 <Upgrade Id="PUT-GUID-HERE">
    <UpgradeVersion OnlyDetect="yes" Minimum="$(var.ProductVersion)" Property="NEWERVERSIONDETECTED" IncludeMinimum="no" />
    <UpgradeVersion OnlyDetect="no" Maximum="$(var.ProductVersion)" Property="OLDERVERSIONBEINGUPGRADED" IncludeMaximum="no" />
</Upgrade>

<InstallExecuteSequence>
    <RemoveExistingProducts After="InstallInitialize" />
</InstallExecuteSequence>

Now my question is if Product Id is randomized (*) to allow a major upgrade to take place, is there any other way to add an uninstall shortcut to the start menu or must we do it through Add/Remove programs? I'd prefer to create the shortcut in the start menu since it's just easier for the user. Obviously the way it is now, it won't work because [ProductCode] that is used in the msiexec arguments will change on every install. Thanks.

like image 763
Jack Avatar asked Apr 23 '11 12:04

Jack


1 Answers

Are you saying you've tried it and it doesn't work? How does it fail? What is the shortcut argument? Using Product/@Id="*" sets the ProductCode property, so it should work correctly.

like image 111
Bob Arnson Avatar answered Nov 20 '22 21:11

Bob Arnson