1
votes

I try to capture the error log of a dot.net application, written in vb/c#, in the log of a buildpipeline task.

The buildpipeline task is basically a powershell script which is calling the executeable of the dot.net application.

...
Start-Process -FilePath $Path -ArgumentList $argumentList -Wait
...

To allow to execute the dot.net application on networkmachines, I put this command inside a Script-Block and open a PSSession. (Maybe, it make the difference?)

Invoke-Command $Block -Session $session -ArgumentList $argumentList

Inside the dot.net application I print errors like

Console.Error.WriteLine($"+++++ {Message}:")

but the pipeline log keeps empty. I do not have make this expirence with other tools like git.exe or something else.

So what is wrong with the dot.net application?

1
Hi Did you check out below solution and try out flag -NoNewWindow, how did it go? - Levi Lu-MSFT

1 Answers

1
votes

I wrote a simple scripts for testing. I found above Start-Process command will open a new console window to execute the dot.net application. And the Error log was printed in the new console window. That's probably why the powershell task cannot capture the error log.

It was fixed by adding flag -NoNewWindow to above Start-Process command to run the dot.net application in the current console window.

Start-Process -FilePath $Path -ArgumentList $argumentList -NoNewWindow -Wait