简体   繁体   中英

WiX UNinstalling files and Reg Keys on Install

I have a WiX installer on my Windows Form Application. I always do a major upgrade so every build will serve as an installer(new customer) and an updater(previous customer). The problem I am having is that the Installer is removing registry keys and config files that were previously installed by the installer and subsequently modified.

For example, on initial install, I put in a file in C:\\programdata\\myConfig.xml. After Install the user modifies the file by replacing it with his config.xml. When my Installer runs on an upgrade, the installer removes this file. When the Installer runs and the file does not exist, it installs myconfig.xml correctly.

I want the installer to never overwrite an existing file, and NEVER remove it either.

<DirectoryRef Id="myFolder">
  <Component Id="CMP_ConfigFile" Guid="{some guid}" NeverOverwrite="yes">
    <File Id="myConfiguration.xml" Source="RefFiles\myConfig\xml" KeyPath="yes"/>
  </Component>
</DirectoryRef>

Above is the code block from my WiX installer. I am having the same issue with my registry keys. WiX is removing them on Upgrade.

<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>

Thoughts? Kurt

You need to add the Permanent attribute to the component and set it to yes that will prevent the component from being uninstalled

<Component Id="CMP_ConfigFile" Guid="{some guid}" NeverOverwrite="yes" Permanent="yes">
  <File Id="myConfiguration.xml" Source="RefFiles\myConfig\xml" KeyPath="yes"/>
</Component>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM