WiX: installation patch replaces previous versions (1.0.0 & # 8594; 1.0.1, 1.0.0 & # 8594; 1.0.2, 1.0.1 & # 8594; 1.0.2, aso.)

I am trying to provide a simple installer package (MSI) that I want to support with updates (patches) that replace all previous fixes. So I have MSI V1.0.0 and 2 patches V1.0.1 and V1.0.2. The user should be able to install the latest version, regardless of what previous fixes have already been applied to the system. My project contains 2 functions (client and server). The patch is always based on an RTM package (HelloWorld 1.0.msi / HelloWorld 1.0.wixpdb).

The generation (assembly) of all patches works, so the update procedures 1.0.0 β†’ 1.0.1 and 1.0.0 β†’ 1.0.2 do, BUT, when I try to upgrade from 1.0.1 to 1.0.2 the patch fails with the following message about error: β€œThe update patch cannot be installed by the Windows Installer service because the program you want to update may not be available, or the update patch may update another version of the program. Make sure the program on your computer has an update and you have a fix to fix it " Even worse, when I run patch 1.0.1 on a system where 1.0.2 is already installed, the patch overwrites the existing installation with an older version !? I am completely confused ...

I also found several blog posts on the Internet about patches, but nothing works with my supersede szenario.

The wix fix code is "patch1.wxs":

<?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Patch AllowRemoval="yes" Manufacturer="My Company" MoreInfoURL="http://www.mycompany.com/" DisplayName="HelloWorld V1.0 Patch 1" Description="Patch intaller updating HelloWorld V1.0.x to V1.0.1" Classification="Update"> <Media Id="32000" Cabinet="HelloWorldRTM.cab"> <PatchBaseline Id="HelloWorldRTM"> <Validate ProductId="yes" UpgradeCode="yes" ProductVersionOperator="LesserOrEqual" /> </PatchBaseline> </Media> <PatchFamilyRef Id="HelloWorldPatchFamily"/> </Patch> <Fragment> <PatchFamily Id='HelloWorldPatchFamily' Version='1.0.1.0' Supersede='yes'> <PropertyRef Id="ProductVersion"/> <ComponentRef Id="HelloWorldServer.dll"/> </PatchFamily> </Fragment> </Wix> 

patch 1 build script - "generate_patch1.bat":

 "%WIX%\bin\torch.exe" -p -xi ".\_Distrb\HelloWorld 1.0.wixpdb" ".\_Distrb\HelloWorld 1.0.1.wixpdb" -out ".\_Build\patch1.wixmst" "%WIX%\bin\candle.exe" -out ".\_Build\patch1.wixobj" ".\patch1.wxs" "%WIX%\bin\light.exe" ".\_Build\patch1.wixobj" -out ".\_Build\patch1.wixmsp" "%WIX%\bin\pyro.exe" ".\_Build\patch1.wixmsp" -out ".\_Distrb\HelloWorld 1.0 Patch1.msp" -t HelloWorldRTM ".\_Build\patch1.wixmst" 

The wix fix code is "patch2.wxs":

 <?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Patch AllowRemoval="yes" Manufacturer="My Company" MoreInfoURL="http://www.mycompany.com/" DisplayName="HelloWorld V1.0 Patch 2" Description="Patch intaller updating HelloWorld V1.0.x to V1.0.2" Classification="Update"> <Media Id="32000" Cabinet="HelloWorldRTM.cab"> <PatchBaseline Id="HelloWorldRTM"> <Validate ProductId="yes" UpgradeCode="yes" ProductVersionOperator="LesserOrEqual" /> </PatchBaseline> </Media> <PatchFamilyRef Id="HelloWorldPatchFamily"/> </Patch> <Fragment> <PatchFamily Id='HelloWorldPatchFamily' Version='1.0.2.0' Supersede='yes'> <PropertyRef Id="ProductVersion"/> <ComponentRef Id="HelloWorldServer.dll"/> <ComponentRef Id="HelloWorld.exe"/> </PatchFamily> </Fragment> </Wix> 

patch 2 build script - "generate_patch2.bat":

 "%WIX%\bin\torch.exe" -p -xi ".\_Distrb\HelloWorld 1.0.wixpdb" ".\_Distrb\HelloWorld 1.0.2.wixpdb" -out ".\_Build\patch2.wixmst" "%WIX%\bin\candle.exe" -out ".\_Build\patch2.wixobj" ".\patch2.wxs" "%WIX%\bin\light.exe" ".\_Build\patch2.wixobj" -out ".\_Build\patch2.wixmsp" "%WIX%\bin\pyro.exe" ".\_Build\patch2.wixmsp" -out ".\_Distrb\HelloWorld 1.0 Patch 2.msp" -t HelloWorldRTM ".\_Build\patch2.wixmst" 
+4
source share
1 answer

I had a similar problem, and I got the fix by adding the appropriate check for the wxs patch. Try it...

 <Media Id="32000" Cabinet="HelloWorldRTM.cab"> <PatchBaseline Id="HelloWorldRTM"> <Validate ProductId="yes" UpgradeCode="yes" ProductVersion="Major" ProductVersionOperator="GreaterOrEqual" /> </PatchBaseline> </Media> 

If you do not want the patch to work when the installed version number is greater than the patch version number, you can change ProductVersion to Update and set ProductVersion to GreaterOrEqual.

I hope this works for you!

+1
source

Source: https://habr.com/ru/post/1400006/


All Articles