我正在尝试使用Wix支持补丁,并且正在寻找像on this SO post
这样的答案正如所建议的那样,我使用了"使用Purely WiX"代码进行一些测试并创建了3个版本1.0,1.1和1.2
我可以正确地应用每个MSI进行升级而不会出现错误,而在ARP中,版本会增加。
我可以从1.0或1.1补丁到1.2但在ARP中版本不会更新。在修补1.2并运行1.1 MSI安装程序之后,我还没有得到关于降级的警告。
我在哪里错了。
以下是来源:
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product Id='*' Name='Foobar $(var.Version)' UpgradeCode='PUT-GUID-HERE'
Language='1033' Codepage='1252' Version='$(var.Version).0.0' Manufacturer='Acme Ltd.'>
<Package Id='*' Keywords='Installer' Description="Acme's Foobar $(var.Version) Installer"
Comments='Foobar is a registered trademark of Acme Ltd.' Manufacturer='Acme Ltd.'
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<MajorUpgrade DowngradeErrorMessage='A newer version is already installed.' />
<MediaTemplate EmbedCab='yes' />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='Acme' Name='Acme'>
<Directory Id='INSTALLDIR' Name='Foobar'>
<Component Id='MainExecutable' Guid='*'>
<File Id='SampleTXT' Name='Sample.txt' DiskId='1' Source='ver$(var.Version)\Sample.txt' KeyPath='yes' />
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id='Complete' Level='1'>
<ComponentRef Id='MainExecutable' />
</Feature>
</Product>
</Wix>
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Patch AllowRemoval="yes" Manufacturer="Acme Ltd." MoreInfoURL="www.acmefoobar.com"
DisplayName="Foobar 1.1.0 Patch" Description="Small Update Patch" Classification="Update">
<Media Id='5000' Cabinet='Sample.cab'>
<PatchBaseline Id='Sample'/>
</Media>
<PatchFamily Id='SamplePatchFamily' Version='1.1.0.0' Supersede='yes'>
<ComponentRef Id='MainExecutable'/>
</PatchFamily>
</Patch>
</Wix>
并建立:
"%WIX_COMP_CMD%" -nologo -dVersion=1.0 Product.wxs
"%WIX_LINK_CMD%" -nologo Product.wixobj -out ver1.0\Product.msi
"%WIX_COMP_CMD%" -nologo -dVersion=1.1 Product.wxs
"%WIX_LINK_CMD%" -nologo Product.wixobj -out ver1.1\Product.msi
"%WIX_COMP_CMD%" -nologo -dVersion=1.2 Product.wxs
"%WIX_LINK_CMD%" -nologo Product.wixobj -out ver1.2\Product.msi
"%WIX_TORCH_CMD%" -nologo -p -xi ver1.0\Product.wixpdb ver1.2\Product.wixpdb -out Patch_0_2.wixmst
"%WIX_TORCH_CMD%" -nologo -p -xi ver1.1\Product.wixpdb ver1.2\Product.wixpdb -out Patch_1_2.wixmst
"%WIX_COMP_CMD%" -nologo Patch.wxs
"%WIX_LINK_CMD%" -nologo Patch.wixobj
"%WIX_PYRO_CMD%" -nologo Patch.wixmsp -out Patch.msp -t Sample Patch_0_2.wixmst -t Sample Patch_1_2.wixmst