title: WIX – change config file during installation
body: <p>I've an ASP.NET project, a WIX installer project for it, and a build file for the installer. The build file:</p>
  
  <ul>
  <li>Builds my project</li>
  <li>Publishes the website into a directory (<code>SetupFiles/publish/</code>)</li>
  <li>The WIX's <code>heat.exe</code> 'Harvest's the website's files</li>
  <li>After that creates the installer with <code>candle.exe</code> and <code>light.exe</code></li>
  </ul>
  
  <p>I'd like to modify one of the config files (the <code>Web.Release.config</code>, which harvested from the <code>SetupFiles/publish</code> directory) during the install. I found the following code for it:</p>
  
  <pre><code>&lt;Component Id="ChangeConfig" Guid="[YOUR_GUID_HERE]"&gt;
     &lt;File Id="App.config" Name="MyApplication.exe.config" Vital="yes" KeyPath="yes" Source="[Path to project dir]\app.config" /&gt;
     &lt;util:XmlFile Id="AppConfigSetConnStr" Action="setValue" Permanent="yes" File="[#App.config]"            
      ElementPath="/configuration/connectionStrings/add[\[]@name='MyDatabaseName'[\]]" Name="connectionString" 
      Value="Your Connection string values here" /&gt;
  &lt;/Component&gt;
  </code></pre>
  
  <p>From <a href="https://stackoverflow.com/a/290374/2891426">this</a> question.</p>
  
  <p>My problem is, what should I write into the File's tag Source attribute? If I write <code>SetupFiles/publish/Web.Release.config</code>, the light.exe gives the following error:</p>
  
  <pre><code>  D:\Works\Employer\MyProject12345\trunk\Project.Setup\SetConfigFile.wxs(7): er
  ror LGHT0204: ICE30: The target file 'cktmp8gm.con|Web.Release.config' is insta
  lled in '[TARGETDIR]\Inetpub\Proje\' by two different components on an LFN syst
  em: 'cmpA0B9415D5BC7EAB6CA7F504326ED1B32' and 'ChangeConfig'. This breaks compo
  nent reference counting. [D:\Works\Employer\MyProject12345\trunk\Project.Setup\
  setup.build]
  </code></pre>
  
  <p>If I write simply <code>Web.Release.config</code>, the light.exe says it cannot find the file.</p>
  
  <p>I tried <code>[INSTALLDIR]/Web.Release.config</code> (the <code>INSTALLDIR</code> is a variable in my setup project), but in this case the light.exe also says it cannot find the file.</p>
  
  <p>Thanks for your help!</p>