Adding Project References
Introduction
The WiX project supports adding project references to other projects such as VB and C#. This ensures that build order dependencies are defined correctly within the solution. In addition, it generates a set of WiX preprocessor definitions which are set on the Candle command line and can be referenced in source files.
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, then click OK to dismiss the dialog.
List of Supported Project References
The WiX project supports the following project reference variables:
Variable name |
Example usage |
Example value |
var.ProjectName.Configuration |
$(var.MyProject.Configuration) |
Debug or Release |
var.ProjectName.FullConfiguration |
$(var.MyProject.FullConfiguration) |
Debug | AnyCPU |
var.ProjectName.Platform |
$(var.MyProject.Platform) |
AnyCPU, Win32, x64 or ia64 |
var.ProjectName.ProjectDir |
$(var.MyProject.ProjectDir) |
C:\users\myusername\Documents\Visual Studio 2005\Projects\MyProject\ |
var.ProjectName.ProjectExt |
$(var.MyProject.ProjectExt) |
.csproj |
var.ProjectName.ProjectFileName |
$(var.MyProject.ProjectFileName) |
MyProject.csproj |
var.ProjectName.ProjectName |
$(var.MyProject.ProjectName) |
MyProject |
var.ProjectName.ProjectPath |
$(var.MyProject.ProjectPath) |
C:\users\myusername\Documents\Visual Studio 2005\Projects\MyProject\MyApp.csproj |
var.ProjectName.TargetDir |
$(var.MyProject.TargetDir) |
C:\users\myusername\Documents\Visual Studio 2005\Projects\MyProject\obj\Debug\ |
var.ProjectName.TargetExt |
$(var.MyProject.TargetExt) |
.exe |
var.ProjectName.TargetFileName |
$(var.MyProject.TargetFileName) |
MyProject.exe |
var.ProjectName.TargetName |
$(var.MyProject.TargetName) |
MyProject |
var.ProjectName.TargetPath |
$(var.MyProject.TargetPath) |
C:\users\myusername\Documents\Visual Studio 2005\Projects\MyProject\obj\Debug\MyProject.exe |
var.ProjectName.Culture.TargetPath |
$(var.MyProject.en-US.TargetPath) |
C:\users\myusername\Documents\Visual Studio 2005\Projects\MyProject\obj\Debug\en-US\MyProject.msm |
var.SolutionDir |
$(var.SolutionDir) |
C:\users\myusername\Documents\Visual Studio 2005\Projects\MySolution\ |
var.SolutionExt |
$(var.SolutionExt) |
.sln |
var.SolutionFileName |
$(var.SolutionFileName) |
MySolution.sln |
var.SolutionName |
$(var.SolutionName) |
MySolution |
var.SolutionPath |
$(var.SolutionPath) |
C:\users\myusername\Documents\Visual Studio 2005\Projects\MySolution\MySolution.sln |
Note:var.ProjectName.Culture.TargetPath is only available for projects that have multiple localized outputs (e.g. MSMs).
Example
The following File element demonstrates how to use project references in WiX authoring:
<File Id="MyExecutable" Name="$(var.MyProject.TargetFileName)" Source="$(var.MyProject.TargetPath)" DiskId="1" />