title: How to include a configuration-dependent project output in WiX 3.6
body: <p>I'm wondering, how to include a configuration-dependent project output in WiX Setup Project?
  For example, let's look at Visual Studio solution with one .NET application and one Wix Setup Project.  </p>
  
  <p>I've added a reference to .NET app in Setup project and created component in setup source:</p>
  
  <pre><code>  &lt;Component Guid="EB0CBC32-5AE5-41B3-A343-FEBE044AC30A"&gt;
      &lt;File Source="$(var.MyApp.TargetPath)" KeyPath="yes"/&gt;
    &lt;/Component&gt;
  </code></pre>
  
  <p>So, I expect, that WiX will include a <strong>release</strong> version of MyApp in its <strong>release</strong> setup msi, and debug version in debug msi respectively. Otherwise, reference to the project output makes no sense for me.  </p>
  
  <p>But there's always debug version.
  What am I doing wrong?</p>
  
  <p><strong>UPDATE.</strong></p>
  
  <p>Here's candle's command prompt from VS output window:</p>
  
  <blockquote>
    <p>------ Rebuild All started: Project: <strong>MySetup, Configuration: Release x86</strong> ------<br>
            C:\Program Files\WiX Toolset v3.6\bin\candle.exe -d"DevEnvDir=C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\" -dSolutionDir=D:\Projects\Research\Wix_ProjectOutput\ -dSolutionExt=.sln -dSolutionFileName=Wix_ProjectOutput.sln -dSolutionName=Wix_ProjectOutput -dSolutionPath=D:\Projects\Research\Wix_ProjectOutput\Wix_ProjectOutput.sln -dConfiguration=Release -dOutDir=..\Release\ -dPlatform=x86 -dProjectDir=D:\Projects\Research\Wix_ProjectOutput\MySetup\ -dProjectExt=.wixproj -dProjectFileName=MySetup.wixproj -dProjectName=MySetup -dProjectPath=D:\Projects\Research\Wix_ProjectOutput\MySetup\MySetup.wixproj -dTargetDir=D:\Projects\Research\Wix_ProjectOutput\Release\ -dTargetExt=.msi -dTargetFileName=MySetup.msi -dTargetName=MySetup -dTargetPath=D:\Projects\Research\Wix_ProjectOutput\Release\MySetup.msi
    <strong>-dMyApplication.Configuration=Debug</strong> -d"MyApplication.FullConfiguration=Debug|x86" -dMyApplication.Platform=x86 -dMyApplication.ProjectDir=D:\Projects\Research\Wix_ProjectOutput\MyApplication\ -dMyApplication.ProjectExt=.csproj -dMyApplication.ProjectFileName=MyApplication.csproj -dMyApplication.ProjectName=MyApplication -dMyApplication.ProjectPath=D:\Projects\Research\Wix_ProjectOutput\MyApplication\MyApplication.csproj -dMyApplication.TargetDir=D:\Projects\Research\Wix_ProjectOutput\Debug\ -dMyApplication.TargetExt=.exe -dMyApplication.TargetFileName=MyApplication.exe -dMyApplication.TargetName=MyApplication -dMyApplication.TargetPath=D:\Projects\Research\Wix_ProjectOutput\Debug\MyApplication.exe -out obj\Release\ -arch x86 Product.wxs</p>
  </blockquote>
  
  <p>Why for the <strong>release</strong> build of MySetup was used <strong>debug</strong> configuration of MyApplication??  </p>
  
  <p><strong>UPDATE 2</strong>.  </p>
  
  <p>And here's candle's command prompt, when using msbuild from command line:</p>
  
  <pre><code>%windir%\Microsoft.NET\Framework\v4.0.30319\MsBuild.exe /verbosity:d /t:rebuild /fileLogger /p:Configuration=Release  Wix_ProjectOutput.sln 
  </code></pre>
  
  <p>In <code>msbuild.log</code>:</p>
  
  <blockquote>
    <p>C:\Program Files\WiX Toolset v3.6\bin\candle.exe -d"DevEnvDir=<em>Undefined if not building from within Visual Studio</em>" -dSolutionDir=D:\Projects\Research\Wix_ProjectOutput\ -dSolutionExt=.sln -dSolutionFileName=Wix_ProjectOutput.sln -dSolutionName=Wix_ProjectOutput -dSolutionPath=D:\Projects\Research\Wix_ProjectOutput\Wix_ProjectOutput.sln -dConfiguration=Release -dOutDir=..\Release\ -dPlatform=x86 -dProjectDir=D:\Projects\Research\Wix_ProjectOutput\MySetup\ -dProjectExt=.wixproj -dProjectFileName=MySetup.wixproj -dProjectName=MySetup -dProjectPath=D:\Projects\Research\Wix_ProjectOutput\MySetup\MySetup.wixproj -dTargetDir=D:\Projects\Research\Wix_ProjectOutput\Release\ -dTargetExt=.msi -dTargetFileName=MySetup.msi -dTargetName=MySetup -dTargetPath=D:\Projects\Research\Wix_ProjectOutput\Release\MySetup.msi <strong>-dMyApplication.Configuration=Release</strong> -d"MyApplication.FullConfiguration=Release|x86" -dMyApplication.Platform=x86 -dMyApplication.ProjectDir=D:\Projects\Research\Wix_ProjectOutput\MyApplication\ -dMyApplication.ProjectExt=.csproj -dMyApplication.ProjectFileName=MyApplication.csproj -dMyApplication.ProjectName=MyApplication -dMyApplication.ProjectPath=D:\Projects\Research\Wix_ProjectOutput\MyApplication\MyApplication.csproj -dMyApplication.TargetDir=D:\Projects\Research\Wix_ProjectOutput\Release\ -dMyApplication.TargetExt=.exe -dMyApplication.TargetFileName=MyApplication.exe -dMyApplication.TargetName=MyApplication -dMyApplication.TargetPath=D:\Projects\Research\Wix_ProjectOutput\Release\MyApplication.exe -out obj\Release\ -arch x86 Product.wxs</p>
  </blockquote>
  
  <p>So, under msbuild all is OK.</p>
  
  <p><strong>UPDATE 3</strong>.</p>
  
  <p>Looks like WiX uses <strong>active</strong> build configuration (see combobox at VS toolbar).<br>
  I mean, if <code>Debug</code> is selected there, WiX projects will include debug output of referenced projects. If <code>Release</code> is selected, WiX projects will include release output.  </p>
  
  <p>This behavior isn't correct from my point of view. <code>Debug</code> installer must include <strong>debug</strong> output of referenced projects. <code>Release</code> installer - <strong>release</strong> output.</p>
  
  <p>Posted bug <a href="https://sourceforge.net/tracker/?func=detail&amp;aid=3558938&amp;group_id=105970&amp;atid=642714" rel="nofollow">here</a>, but now it is closed without any explanation.</p>
  
  <p>Any ideas?</p>