Possible Duplicate:
Any good PowerShell MSBuild tasks?
Powershell doesn't seem to have an easy way to trigger it with an arbitrary command and then bubble up parse and execution errors in a way that correctly interoperates with callers that are not PowerShell - e.g., cmd.exe
, TeamCity等
我的问题很简单。使用OOTB MSBuild v4和PowerShell v3对我来说最好的方法是什么(建议开放-不会排除适合生产的MSBuild Task,但它比建议“要简单-拿PowerShell Task Factory示例和调整它和/或使其成为维护者/父对象”,以运行命令(一个小的脚本段,或者(最常见的)调用.ps1
脚本。
我认为这应该是正常的:
<Exec
IgnoreStandardErrorWarningFormat="true"
Command="PowerShell "$(ThingToDo)"" />
不幸的是,这不起作用:
ThingToDo
解析失败,则默默地失败ThingToDo
是不存在的脚本调用,则ERRORLEVEL
的.cmd
结果,它将变得毛茸茸"
中嵌入ThingToDo
引号,则无法使用那么,从MSBuild运行PowerShell的防弹方法应该是什么?我可以通过PsGet使一切正常吗?