我需要在卸载时从现有配置文件中删除元素。这是相关的Wix:
<Component Id="Dynamics.exe.config" DiskId="1" Permanent="yes">
<File Id="AppConfig" Name="Dynamics.exe.config" Source="$(var.ProgramFilesDir)\Microsoft Dynamics\GP2010\Dynamics.exe.config" KeyPath="yes" />
<util:XmlConfig
Id="AppSettings"
Action="create"
ElementPath="//configuration"
Name="appSettings"
File="[#AppConfig]"
Sequence="1"
VerifyPath="appSettings"
Node="element"
On="install"/>
<util:XmlConfig
Id="AppSettings1"
Action="create"
ElementPath="//configuration/appSettings"
Name="add"
File="[#AppConfig]"
Sequence="2"
VerifyPath="add[\[]@key='AppName'[\]]"
Node="element"
On="install"/>
<util:XmlConfig
Id="AppSettingsKey1"
ElementPath="AppSettings1"
Name="key"
Value="AppName"
File="[#AppConfig]"
Sequence="3" />
<util:XmlConfig
Id="AppSettingsValue1"
ElementPath="AppSettings1"
Name="value"
Value="MyApp"
File="[#AppConfig]"
Sequence="4" />
<util:XmlConfig
Id="AppSettingsRemove1"
Action="delete"
ElementPath="//configuration/appSettings"
File="[#AppConfig]"
Sequence="2"
VerifyPath="add[\[]@key='AppName'[\]]"
Node="element"
On="uninstall"/>
创建操作运行。但是,删除/卸载操作不会运行。它不会修改文件。似乎在卸载过程中跳过了该文件。