主要升级和配置文件是软件的常见组成部分。
重大升级声明:
<MajorUpgrade DowngradeErrorMessage="A newer version of $(var.AppName) is already installed." AllowSameVersionUpgrades="yes" />
在进行重大升级时,不应删除和覆盖配置文件。配置文件必须保留。这是通过以下声明实现的:
<Component Id="MyConfigComponent" NeverOverwrite="yes" Permanent="yes" Guid="MY-GUID-HERE">
<File Id="MyConfigOutput" KeyPath="yes" Name="MyConfig.config" Source="..\MyApp\MyConfig.config.bak"/>
</Component>
如何MyConfig.config
在卸载时删除文件?
使用类似声明<RemoveFile On="uninstall" Name="MyConfig.config" ... >
会删除升级中的配置文件。因此,它不能用于此目的。这同样适用于RemoveFolderEx
。我该用什么来代替?