0
使用Visual Studio安装项目时,如果安装失败,它将恢复到以前版本的安装,因此它恢复了以前的文件。 但是,使用WiX安装程序时,如果安装失败,则WiX安装程序将删除已安装文件夹上的所有文件。 如何在安装失败时让WiX安装程序恢复以前的文件?恢复到以前版本的wix安装程序
谢谢。
这是在维克斯安装为Windows服务的Product.wxs:
<Product Id="*" Name="WixWindowsService2012" Language="1033" Version="1.0.0.1" Manufacturer="aaa" UpgradeCode="blabla">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platforms="x64"/>
<Upgrade Id="blabla">
<UpgradeVersion OnlyDetect="no" Property="PREVIOUSFOUND"
Minimum="1.0.0.0" IncludeMinimum="yes"
Maximum="99.0.0.0" IncludeMaximum="no" />
</Upgrade>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="WixWindowsService2012" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
:
<Component Id="ProductComponent" Win64="yes">
<File Id="WixWindowsService2012.exe" Name="WixWindowsService2012.exe" Source="$(var.WixWindowsService2012.TargetPath)" Vital="yes" KeyPath="yes" DiskId="1"/>
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="WixWindowsService2012"
DisplayName="WixWindowsService2012"
Description="A test for WiX installation for Windows Service"
Start="auto"
Account="LocalSystem"
ErrorControl="ignore"
Interactive="no"></ServiceInstall>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="WixWindowsService2012" Wait="yes" />
</Component>
感谢您的快速回复。 在下面的MajorUpgrade元素中添加Schedule =“afterInstallInitialize”就是我所需要的。 再次感谢您。 –
faujong