简体   繁体   中英

TFS Custom Build Task, Powershell script shows additional blank lines in log

When running a custom build task that includes a powershell script, there will be additional blank lines in my log. How it looks like: “Write-Host”之间的两个额外空行。

My Powershell Skript:

Write-Host "# #############Run SQL Script############# #"
Write-Host "Instance of the Database Server: $Database_ServerInstance"
Write-Host "FilePath of the SQLScript: $Script_FilePath"

How do I get rid of the additional blank lines?

When you write

Write-host “hello”

You actually get:

'hello' | Out-Default | Out-Host

PowerShell will apply the default formatting (which can be altered by configuration files on the host) to Out-default and the again to out-host (display in our case). Even worst, the formatting rules are different among versions and for desktop and server PowerShell.

try with write-output to see if you get different formatting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM