在安装新版本之前,我正在执行主要升级和卸载现有产品。但我想保留现有的配置文件。Wix CopyFile在卸载之前卸载并恢复后卸载
由于早期版本没有永久性=“是”,它会在卸载时删除配置文件。
我该如何做这样的事情,在卸载之前将'app.config'的副本作为'app.config.bak'。卸载后,将其从“app.config.bak”恢复为“app.config”。
<DirectoryRef Id="INSTALLDIR">
<Component Id="BackupConfigComponent" Guid="87368AF7-4BA2-4302-891A-B163ADDB7E9C">
<CopyFile Id="BackupConfigFile" SourceDirectory="INSTALLFOLDER" SourceName="app.config" DestinationDirectory="INSTALLFOLDER" DestinationName="app.config.bak" />
</Component>
</DirectoryRef>
<DirectoryRef Id="INSTALLDIR">
<Component Id="RestoreConfigComponent" Guid="87368AF7-4BA2-4302-891A-B163ADDB7E9C">
<CopyFile Id="RestoreConfigFile" SourceDirectory="INSTALLFOLDER" SourceName="app.config.bak" DestinationDirectory="INSTALLFOLDER" DestinationName="app.config" />
</Component>
</DirectoryRef>
<InstallExecuteSequence>
<Custom Action="BackupConfigFile" After="InstallInitialize" />
<RemoveExistingProducts After="InstallInitialize" />
<Custom Action="RestoreConfigFile" After="InstallInitialize" />
</InstallExecuteSequence>
感谢
它表示错误 Custom/@ After属性值'RemoveExistingProducts'不是合法标识符。标识符可能包含ASCII字符A-Z,a-z,数字,下划线(_)或句点(。)。每个标识符必须以字母或下划线开头。 –
好吧,这是由于空间,但现在它说,'产品:*'节中符号'CustomAction:BackupConfigFile'的未解析引用。 –
您是否使用名称BackupConfigFile创建了自定义操作?这不是Windows Installer将为您提供的标准自定义操作。 – Adkins