I've done it and it works fine. One tricky thing was working with PowerShell's parsing modes to get the arguments passed-in correctly (notice the back-tick-escaped double quotes in the $msBuildArgs parameter, below). If you manually use Candle/Light you have to worry about compiling fragments ahead of time and passing them into Light (ugh). It's much easier to set up a Visual Studio project and call msbuild on it. :)
Here is a stripped down version of the script I call to compile .sln files. I haven't tested this exact code, but it should get you in the right direction. I'd call it with a command somewhat like /c:\path\MyInstaller.sln | c:\buildTools\compileWixSolution.ps1/ , assuming you save it to "compileWixSolution.ps1" and the defaults for the last two parameters are correct. You can also pipe in multiple solutions, which I do. It will create a nice log file if msbuild had errors compiling the project. param ( [parameter( Mandatory=$true, ValueFromPipeline=$true)] [System.IO.FileInfo] # The solution to compile $file, [System.IO.FileInfo] # The handle to the MSBuild executable. $msBuild = "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\msbuild.exe", [String] $msbuildArgs = "`"$file`" /target:rebuild `"/property:Configuration=Debug;Platform=x86`" /v:minimal /maxcpucount:2" ) Process { $log = ("" + $file.FullName + "_msbuild.log") if(Test-Path $log){ Remove-Item $log } # Remove old, previous log file. # Run msbuild $process = Start-Process $msBuild -ArgumentList $msbuildArgs -Wait -PassThru -NoNewWindow -RedirectStandardOutput $log if($process.ExitCode) { Write-Error "Error from $msBuild. See $log" } } Edwin G. Castro wrote > > Are you trying to build a wix project? The easiest way to do this is to > simply call > > msbuild solution.sln > > Or perhaps > > msbuild project.wixproj > > Passing the usual command line arguments to msbuild. > > If you are truly looking to call candle.exe, light.exe, etc. then just > call them with the appropriate arguments. > > What exactly is your goal? > >> -----Original Message----- >> From: Sean Farrow [mailto:sean.farrow@.co] >> Sent: Monday, May 07, 2012 7:29 PM >> To: wix-users@.sourceforge >> Subject: [WiX-users] using wix with powershell >> >> Hi All: >> Has anybody got any experience of automating wix from powershell, either >> from the standard interface or writing cmdlets. >> I'm looking to automate a build system. >> Any help appreciated.Regards >> Sean. > -- View this message in context: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/using-wix-with-powershell-tp7537541p7548429.html Sent from the wix-users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users