gpt4 book ai didi

powershell - Psake-如何为MSBuild激活/m开关?

转载 作者:行者123 更新时间:2023-12-03 01:11:37 26 4
gpt4 key购买 nike

嗨,我正在尝试使用MSBuild和Psake编译我的项目,但是将/ m传递给MSBuild时遇到问题。这是我的代码:

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

MSBuild输出:

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


请注意, / m 现在是输出路径的一部分

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



提前致谢

最佳答案

尝试不将所有参数放在一个字符串中。这是我的MSBuild任务在pSake中的样子的两个示例:

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

和...
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
}
}

请注意,我将 "放在我认为可能包含空格的所有变量周围。

因此,为您尝试以下操作:
Exec {
MSBuild "$solutionFile" /p:Configuration=$buildConfiguration;Platform=$buildPlatform;OutDir="$tempPath" /m
}

关于powershell - Psake-如何为MSBuild激活/m开关?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38518333/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com