mon*_*fer 19 msbuild powershell hang visual-studio-2010
我目前正在考虑重新设计我们的黑客攻击部署系统,使其更加优雅 - 八达通.在这样做的时候,我正在尝试让VS在运行发布版本时打包一个项目.好吧,我有这个花哨的PowerShell脚本编写和工作,但当我尝试从msbuild脚本EXEC,视觉工作室只是挂起!
起初我怀疑是什么东西在shell中被逃脱了,但是我把它简化得很荒谬,它仍然冻结了.
这是相关的MsBuild代码:
<PropertyGroup>
<PowerShellExe Condition=" '$(PowerShellExe)'=='' ">
%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe
</PowerShellExe>
</PropertyGroup>
<Target Name="AfterBuild" Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Exec Command="$(PowerShellExe) -NonInteractive -executionpolicy Unrestricted -command get-childitem" />
</Target>
Run Code Online (Sandbox Code Playgroud)
它应该做的只是提供一个目录列表.从cmd.exe调用此方法工作正常:
C:\Users\smithj>%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe -noninteractive -executionpolicy unrestricted -command dir
Run Code Online (Sandbox Code Playgroud)
试试这个:
msbuild Solution.sln /p:Configuration=Release
Run Code Online (Sandbox Code Playgroud)
得到我这个:
AfterBuild:
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\\tf.exe" che
ckout Package.nuspec
Package.nuspec
%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe
-NonInteractive -executionpolicy Unrestricted -command dir
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
Run Code Online (Sandbox Code Playgroud)
在那之后,它永远挂起.欢迎任何建议.
Jam*_*den 28
不确定你会不会喜欢这个答案.经过一段时间的游戏,似乎是关于房地产集团的扩张.您在PowerShellExe的值中添加了一个新行.这很好用:
<PropertyGroup>
<PowerShellExe Condition=" '$(PowerShellExe)'=='' ">$(WINDIR)\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShellExe>
</PropertyGroup>
<Target Name="AfterBuild">
<Exec Command="$(PowerShellExe) -NonInteractive -executionpolicy bypass -command "&{get-childitem}"" />
</Target>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3186 次 |
| 最近记录: |