1

Hi I'm trying to compile my project using MSBuild & Psake but I have problems passing the /m to MSBuild. Here is my code:

Exec {
    MSBuild $solutionFile "/p:Configuration=$buildConfiguration;Platform=$buildPlatform;OutDir=$tempPath /m"
}

MSBuild Output:

"C:\Users\mabre\Source\Psake\Psake.sln" (default target) (1) -> "C:\Users\mabre\Source\Psake\src\Psake.Library\Psake.Library.xproj" (default target) (5) -> C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(262,5): error : Could not find a part of the path 'C:\Users\mabre\Source\Psake.build\temp \m\src\Psake.Library\obj\Release\netstandard1.6'. [C:\Users\mabre\Source\Psake\src\Psake.Library\Psake.Library.xproj]

0 Warning(s)
4 Error(s)

Note that the /m is part of the output path now

Error: 7/22/2016 12:39:04 AM: At C:\Users\mabre.nuget\packages\psake\4.6.0\tools\psake.psm1:156 char:17 + throw ("Exec: " + $errorMessage) +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [<<==>>] Exception: Exec: Error executing command MSBuild $solutionFile "/p:Configuration=$buildConfiguration;Platform=$buildPlatform;OutDir=$tempPath /m" . Build exit code: 1

Thanks in advance

Miguel
  • 3,786
  • 2
  • 19
  • 32
  • Did you try putting the `/m` first instead of last, so it doesn't get affected by what Psake might add after it? – stijn Jul 22 '16 at 07:02

1 Answers1

3

Try it without putting all of the arguments in one string. Here are two examples of what my MSBuild tasks look like in pSake:

Task CleanProject -depends RestoreNuget {
    Exec {
        msbuild `
            "$VisualStudioSolutionFile" `
            /target:Clean `
            /property:Configuration=$Configuration `
            /verbosity:quiet
    }
}

and...

Task BuildProject -depends DeleteBinAndObjFolders {
    Exec {
        msbuild `
            "$ProjectPath" `
            /target:Rebuild `
            /property:Configuration=$Configuration `
            /property:OutDir="$ProjectBuildArtifactsPath" `
            /property:UseWPP_CopyWebApplication=True `
            /property:PipelineDependsOnBuild=False `
            /property:WebProjectOutputDir="$WebBuildArtifactsPath" `
            /verbosity:quiet
    }
}

Note that I put " around any variables that I think may contains spaces.

So try something like this for yours:

Exec {
    MSBuild "$solutionFile" /p:Configuration=$buildConfiguration;Platform=$buildPlatform;OutDir="$tempPath" /m
}
Jason Boyd
  • 6,839
  • 4
  • 29
  • 47