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.
I've added a reference to .NET app in Setup project and created component in setup source:
<Component Guid="EB0CBC32-5AE5-41B3-A343-FEBE044AC30A">
<File Source="$(var.MyApp.TargetPath)" KeyPath="yes"/>
</Component>
So, I expect, that WiX will include a release version of MyApp in its release setup msi, and debug version in debug msi respectively. Otherwise, reference to the project output makes no sense for me.
But there's always debug version. What am I doing wrong?
UPDATE.
Here's candle's command prompt from VS output window:
------ Rebuild All started: Project: MySetup, Configuration: Release x86 ------
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 -dMyApplication.Configuration=Debug -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
Why for the release build of MySetup was used debug configuration of MyApplication??
UPDATE 2.
And here's candle's command prompt, when using msbuild from command line:
%windir%\Microsoft.NET\Framework\v4.0.30319\MsBuild.exe /verbosity:d /t:rebuild /fileLogger /p:Configuration=Release Wix_ProjectOutput.sln
In msbuild.log
:
C:\Program Files\WiX Toolset v3.6\bin\candle.exe -d"DevEnvDir=Undefined if not building from within Visual Studio" -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 -dMyApplication.Configuration=Release -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
So, under msbuild all is OK.
UPDATE 3.
Looks like WiX uses active build configuration (see combobox at VS toolbar).
I mean, if Debug
is selected there, WiX projects will include debug output of referenced projects. If Release
is selected, WiX projects will include release output.
This behavior isn't correct from my point of view. Debug
installer must include debug output of referenced projects. Release
installer - release output.
Posted bug here, but now it is closed without any explanation.
Any ideas?
Adding a WiX setup project In Visual Studio, open your solution, and add a WiX project to it: go to the Visual Studio main menu and click File -> Add -> New Project to open the Add New Project dialog. Choose the Setup Project item in the Windows Installer XML node, specify the project name and click OK.
To add a project reference to a WiX project: Right-click on the References node of the project in the Solution Explorer and choose Add Reference.... In the Add Reference dialog, click on the Projects tab. Select the desired project(s) and click the Add button, and then press OK to dismiss the dialog.
You may use $(var.Configuration), which is set to solution configuration (Debug, Release, etc...):
<File Id="MyApp.exe" KeyPath="yes" Source="..\MyApp\$(var.Configuration)\MyApp.exe" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With