我有一個項目,有一些後生成事件命令。這些命令需要一些時間才能完成,並且還有控制檯輸出。如果有關係,命令是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