Complete list of Candle preprocessor variables

Some people have asked about this in the past on the wix-users mailing list, so I thought I'd just put it here so it's on the web searches. (We really need to do an overhaul on our WiX home page).

This is just copied verbatim from the Wix.chm file.

[Edit]: By the way, this list applies to Votive v3 and not Votive v2. Although similar, complete instructions on how to do this in Votive v2 are given in Rob's MSDN article here (https://msdn2.microsoft.com/en-us/aa302186.aspx#wixsetup_topic9).

Project References

Introduction

The WiX Visual Studio package supports adding project references to a WiX project. 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.

Adding Project References

To add a project reference to a WiX project:

  1. Right-click on the References node of the project in the Solution Explorer and choose Add Reference...
  2. In the Add WiX Library Reference dialog, click on the Projects tab.
  3. Select the desired project(s) and click the Add button, then click OK to dismiss the dialog.

List of Supported Project References

The WiX Visual Studio package 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.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

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" />