我有一个项目,有一些后生成事件命令。这些命令需要一些时间才能完成,并且还有控制台输出。如果有关系,命令是PowerShell命令/脚本。我发现Visual Studio会像执行命令时不响应一样。一旦这些命令全部执行完毕,整个构建完成后,整个输出将显示在VS的“输出”窗口中。我想要的是输出窗口显示控制台输出发生时,所以当我的脚本运行时,我会看到“开始命令执行...”,“命令1完成,开始命令2 ...”,类似那。这可能吗?输出窗口进度显示
这里就是我的生成后事件命令如下所示:
if "$(ConfigurationName)" == "Release" "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Unrestricted
if "$(ConfigurationName)" == "Release" "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -file "$(SolutionDir)\installshieldAutomationScript.ps1"
if "$(ConfigurationName)" == "Release" "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" Set-ExecutionPolicy Restricted
这里是我的PowerShell脚本的一个片段:
Write-Host "Running post-build script..." -ForegroundColor "Green"
#Do a bunch of stuff here
Write-Host "Post-build script complete!" -ForegroundColor "Cyan"
我已经更新了我的问题,并添加代码片段。 – HotN
@Yvette如果你仍然对这个挑战感兴趣,我还没有想出一个好的解决方案。我可能会重温Meredith的答案,但在我看来,答案会涉及到创建额外的窗口,这感觉就像无法使用Output窗口显示脚本输出的目的。 – HotN