title: Copy external file to install directory WiX
body: <p>I have the same problem like <a href="https://stackoverflow.com/questions/465788/wix-copyfile-attributes">here</a>. I have a <code>.config</code> file that I want to copy from the source directory (where my <code>.msi</code> file is, to my install directory.</p>
  
  <p>I tried several things:</p>
  
  <p><strong>1st thing I tried:</strong></p>
  
  <pre><code>&lt;DirectoryRef Id="ProgramFilesFolder"&gt;
    &lt;Component Id="$(var.productFamily)$(var.productSummary).config" Guid="$(var.GUID_CMP_DemoConfig)" KeyPath="yes"&gt;
      &lt;CopyFile Id="$(var.productFamily)$(var.productSummary).config"
            SourceName="$(var.productFamily)$(var.productSummary).exe.config"
            SourceProperty="SOURCEDIR"
            DestinationDirectory="$(var.productFamily)$(var.productType)"
            DestinationName="$(var.productFamily)$(var.productSummary).exe.config"
             &gt;
      &lt;/CopyFile&gt;
    &lt;/Component&gt;
  &lt;/DirectoryRef&gt;
  </code></pre>
  
  <p>But this method failed, as it's trying to copy the file <strong>before</strong> the application is installed, so my directory still doesn't exist.</p>
  
  <p><strong>2nd thing I tried:</strong></p>
  
  <p>Add it as another component of the installer.</p>
  
  <pre><code>      &lt;Component Id="$(var.productFamily)$(var.productSummary).config" Guid="$(var.GUID_CMP_DemoConfig)"&gt;
          &lt;File Id="$(var.productFamily)$(var.productSummary).config"
                Name="$(var.productFamily)$(var.productSummary).exe.config"
                DiskId="1" KeyPath="yes"
                Source="$(var.productFamily)$(var.productSummary).exe.config" &gt;
          &lt;/File&gt;
        &lt;/Component&gt;
  </code></pre>
  
  <p>With this one I should be able to copy from my <code>Release</code> folder of the installer to my <code>INSTALLDIR</code>, but when I build the project on <code>VS 2010</code>, it doesn't find the file...</p>
  
  <p><strong>3rd thing I tried:</strong></p>
  
  <p>I tried to change the <code>SOURCEDIR</code> var to my own variable, so I could use it as a regular component, doing <a href="https://stackoverflow.com/questions/8492073/heat-generated-files-are-not-able-to-find-sourcedir-directory/8590298#">this</a>. But it doesn't let me change the variable name. It says when trying to change it:</p>
  
  <p><code>heat.exe : error HEAT0319 : The '-out' or '-o' parameter must specify a file path.</code></p>
  
  <p>So I only want to copy a file from where my <code>.msi</code> is located, but I still couldn't do it...</p>
  
  <p>Any ideas?</p>