I\'m invoking a PowerShell script from MSBuild. MSBuild is able to capture the output returned, but thinks the project is built successfully.
The problem is that th
I tried several options but none works for me.
To capture the powershell error on msbuild target, best way is to return the error code from powershell script like $host.SetShouldExit($remotelastexitcode).
e.g. test1.ps1
function CallFromMSBuild {
Invoke-command {Powershell.exe C:\a.ps1} -computername $computers
$host.SetShouldExit(1)
}
Worth to have a look at https://snagify.wordpress.com/2008/04/06/teambuild-powershell-and-exit-codes/