我正在尝试使用 Powershell 如下通过命令行参数 ($args[0]) 传递属性,但没有考虑它。
if ( Test-path -path $args[0]) {
&"$MsbuildBinPath\Msbuild.exe" $MSBuildFile /t:BuildAll "/p:AllComponents=$args[0]" $Logger $ErrorLogger
if ($LastExitCode -ne 0) {
Write-Host "It failed, send a mail"
}
}
如果我像下面这样通过属性,则正在考虑它。
"/p:AllComponents=List.txt"
为什么直接应用命令行参数时不考虑它?
我可以将命令行值存储在某个变量中并传递,但是还有其他机制可以直接传递它吗?