]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Use Invoke-Expression rather than & to run msbuild.exe
authorPaul Durrant <paul.durrant@citrix.com>
Mon, 29 Apr 2019 08:40:09 +0000 (09:40 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Mon, 29 Apr 2019 08:40:09 +0000 (09:40 +0100)
Older versions of powershell seem to have extreme difficulty with quoting
within strings passed to the & operator. Thankfully it seems the issues
can be avoided by building up a single command string then then passing
it to Invoke-Expression instead.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
msbuild.ps1

index b51c4406a8c03f77e31cb91a5222b1a38f7778c7..8da3fda56d820fab5e48a4ab4d9d55d24d8ea177 100644 (file)
@@ -20,18 +20,16 @@ Function Run-MSBuild {
                [string]$Inputs = ""
        )
 
-       $c = [string]::Format("/p:Configuration=`"{0}`"", $Configuration)
-       $p = [string]::Format("/p:Platform=`"{0}`"", $Platform)
-       $t = [string]::Format("/t:`"{0}`"", $Target)
-       $s = Join-Path -Path $SolutionPath -ChildPath $Name
+       $c = "msbuild.exe"
+       $c += [string]::Format(" /p:Configuration=""{0}""", $Configuration)
+       $c += [string]::Format(" /p:Platform=""{0}""", $Platform)
+       $c += [string]::Format(" /t:""{0}"" ", $Target)
        if ($Inputs) {
-               $i = [string]::Format("/p:Inputs=`"{0}`"", $Inputs)
-               Write-Host "msbuild.exe" "/m:1" $c $p $t $i $s
-               & "msbuild.exe" "/m:1" $c $p $t $s $i
-       } else {
-               Write-Host "msbuild.exe" "/m:1" $c $p $t $s
-               & "msbuild.exe" "/m:1" $c $p $t $s
+               $c += [string]::Format(" /p:Inputs=""{0}"" ", $Inputs)
        }
+       $c += Join-Path -Path $SolutionPath -ChildPath $Name
+
+       Invoke-Expression $c
 }
 
 Function Run-MSBuildSDV {