【发布时间】:2013-08-09 19:34:27
【问题描述】:
我有类似的问题,例如bring Wix to not overwrite a configuration file during upgrade 的 forki23。我有一个配置文件,在升级过程中不应被覆盖,但在卸载过程中应将其删除。但是,我找到的每个解决方案都会破坏其他东西。
如果我设置NoOverwrite=yes and move the RemoveExistingProducts to InstallFinalize,配置文件会按照我的意愿进行处理。但是,在这种情况下,由于某种原因,在升级过程中会删除快捷方式。如果我在 InstallInitialize 处保留 RemoveExistingProducts,则配置文件实际上在升级过程中被删除,但是存在快捷方式。
为什么会发生这种情况,有办法解决吗?
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallInitialize" />
<!-- InstallInitialize causes config-file to disappear during upgrade -->
<!-- InstallFinalize causes shortcuts to disappear during upgrade -->
...
<Property Id="DISABLEADVTSHORTCUTS" Value="1" />
...
<Directory Id="INSTALLLOCATION" Name="MyApp">
<Component Id="MYAPP.EXE" DiskId="1" Guid="...">
<File Id="MYAPP.EXE" Name="MyApp.exe" Source="..." Vital="yes" KeyPath="yes">
<Shortcut Id="startmenuShortcut"
Directory="ProgramMenuDir"
Name="!(loc.ProductName)"
WorkingDirectory='INSTALLLOCATION'
Icon="Icon.ico"
IconIndex="0"
Advertise="yes" />
</File>
<RegistryValue Root="HKLM"
Name="InstallLocation"
Key="$(var.InstallLocationRegistryKey)"
Type="string"
Value="[INSTALLLOCATION]">
</RegistryValue>
</Component>
<Component Id="MYAPP.EXE.CONFIG" DiskId="1" Guid="..." NeverOverwrite="yes">
<File Id="MYAPP.EXE.CONFIG"
Name="MyApp.exe.config"
Source="..."
KeyPath="yes" />
</Component>
...
</Directory>
...
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramMenuDir" Name="!(loc.ProductPrefix)">
<Component Id="ProgramMenuDir" Guid="...">
<RegistryValue Root="HKCU" Key="SOFTWARE\MyApp"
Type="string" Value="[INSTALLLOCATION]" KeyPath="yes" />
<RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
</Component>
</Directory>
</Directory>
注意 A:配置文件是机器范围的配置,应该适用于所有用户。
注意 B:我使用的是 WiX 3.7,目标平台是 Windows 7 和 8。
【问题讨论】:
-
只是为了让您知道有关在何处安排 RemoveExistingProducts 的链接...jpassing.com/2007/06/16/… 它可能无法解决您的问题,但至少可以帮助您了解有关 Windows Installer 的更多信息。
标签: wix installation windows-installer wix3.7