[英]WiX UNinstalling files and Reg Keys on Install
我的Windows窗體應用程序上有一個WiX安裝程序。 我總是進行重大升級,因此每個版本都將充當安裝程序(新客戶)和更新程序(以前的客戶)。 我遇到的問題是安裝程序正在刪除先前由安裝程序安裝並隨后被修改的注冊表項和配置文件。
例如,在初始安裝時,我將文件放在C:\\ programdata \\ myConfig.xml中。 安裝后,用戶通過用config.xml替換文件來修改文件。 當我的安裝程序在升級上運行時,安裝程序將刪除此文件。 當安裝程序運行且文件不存在時,它將正確安裝myconfig.xml。
我希望安裝程序不要覆蓋現有文件,也不要刪除它。
<DirectoryRef Id="myFolder">
<Component Id="CMP_ConfigFile" Guid="{some guid}" NeverOverwrite="yes">
<File Id="myConfiguration.xml" Source="RefFiles\myConfig\xml" KeyPath="yes"/>
</Component>
</DirectoryRef>
上面是我的WiX安裝程序的代碼塊。 我的注冊表項存在相同的問題。 WiX會在升級時刪除它們。
<Component Id="RegistryEntriesOne" Guid="{some guid}" Directory="TARGETDIR" NeverOverwrite="yes" >
<RegistryKey Root="HKLM" Key="SOFTWARE\myCompany\myApp" Action="create">
<RegistryValue Type ="string" Name="ConfigurationFilePath" Value="C:\ProgramData\myConfig.xml" KeyPath="yes"/>
</RegistryKey>
</Component>
思考? 庫爾特
您需要將Permanent屬性添加到組件並將其設置為yes,這將防止組件被卸載。
<Component Id="CMP_ConfigFile" Guid="{some guid}" NeverOverwrite="yes" Permanent="yes">
<File Id="myConfiguration.xml" Source="RefFiles\myConfig\xml" KeyPath="yes"/>
</Component>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.