Does anyone know how to get the return code from a .NET executable? I've written a program that has a static main method that returns an int and I can't seem to get this number when I run it from powershell. This is what I currently have:
&$executable $params
exit $LASTEXITCODE
where $executable
is the path to the executable and $params
are the parameters passed to the executable.
However, $LASTEXITCODE
is always 0. The program writes to the console via a Log4Net console appender so the above pipes the output to the console in PowerShell.
Can anyone help?