I still had a lot of trouble getting this to work, but peices of each answer above, contributed to my solution, so I wanted to share.
Environment: TFS Build Server 2010 - Powershell calling MSBuild.exe
Wix 3.6 is installed on the build server
Goal is to pass the build version number and 5 directories into MSBuild, so that Candle.exe will receive them correctly
The Build calls a command file at the end of the build, and that command file, includes a step to call a powershell script to build the Wix installer. It passes in the version number for the build and the source and output directories (the output is a UNC fileshare reference \tfsbuildserver..)
To get it to work, in the Powershell ps1 file,
- use a single /p:DefineConstants= that starts with a double "
- encode all the seperating ; as %3b
- the = are ok unencoded
there should be no additional quotes around any file names with spaces
$msbuild = "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe"
$options = " /p:Configuration=Release /p:Platform=x64 "
$options = $options + " /p:DefineConstants="""
$options = $options + "SolutionDir=" + $SourceDir
$options = $options + "%3bTFSBuildSourceLanding=" + $OutputLocation + "SharepointWebRoot\Landing"
$options = $options + "%3bTFSBuildSourceLandingAdmin=" + $OutputLocation + "SharepointWebRoot\LandingAdmin"
$options = $options + "%3bTFSBuildSourceRegistration=" + $OutputLocation + "Extranet_Registration"
$options = $options + "%3bTFSBuildSourceGAC=" + $OutputLocation + "GAC"
$options = $options + "%3bTFSBuildSourceSQL=" + $OutputLocation + "SQL"
$options = $options + "%3bProductVersion=" + $BuildVersion + """"
$build = $msbuild + " ""EUM WIX\EUM Wix.wixproj"" " + $options + " /t:Build"
$clean = $msbuild + " ""EUM WIX\EUM Wix.wixproj"" " + $options + " /t:Clean"
Write-Host "Building Wix Installer..."
Invoke-Expression $clean
Invoke-Expression $build
answered 2012-08-30T15:13:39.737