从PowerShell运行MSBuild无法找到项目文件

时间:2017-07-21 03:54:30

标签: powershell msbuild

我在PowerShell中运行一个简单的MSBuild,就像这样

$solution = 'E:\VS2017Projects\CmdBuildTest\CmdBuildTest.sln'
$params = '/p:Configuration=Debug /t:Clean /t:Build'
$msbuild = 'C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe'
$argument = $solution + ' ' + $params
#Test-Path $solution
& $msbuild $argument

虽然注释掉的Test-Path确实返回true,但我总是遇到以下错误:

  

MSBUILD:错误MSB1009:项目文件不存在。

当我尝试在命令行中直接运行MSBuild.exe以使用完全相同的文件路径和参数进行构建时,它按预期工作。现在想知道我在PowerShell中做错了什么?

0 个答案:

没有答案
相关问题