I had written a Console Application that I run as part of my post build for other projects.. The Console application logs a series of messages to the console as it executes. I use the Environment.ExitCode value to specify an error or success condition. When the application executes without issue, the ExitCode is 0, when there is a problem its –1. As part of my logging, I log the value of the exit code right before the application terminates. When I run this executable from the command line, it behaves as it should; error scenarios return –1 and success scenarios return 0. When I run the same command line as part of the post-build event, Visual Studio reports the exit code as –1, even when the application reports the exit code as 0. A snippet of the build output follows: Verbose: Exiting with ExitCode=0 C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3397,13): error MSB3073: The command ""MGC.exe" "-TargetPath=C:\TFS\Solutions\Research\Source\Framework\Services\Identity\STS\_STSBuilder\bin\Debug\_STSBuilder.dll" C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3397,13): error MSB3073: C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3397,13): error MSB3073: " exited with code -1. The Application returns a 0 exit code. But visual studio is reporting an error. Why? The answer is in the way I format my log messages. Apparently Visual Studio watches the messages that get streamed to the the output console. If those messages match a pattern used by visual studio to communicate errors, Visual Studio assumes an error has occurred in the executable and returns a –1. This post details the formats used by Visual Studio to determine error conditions. In my case, the presence of the colon was tripping up Visual studio. I Replaced all occurrences of colon with an equal sign and Visual Studio once again respected the exit code of the application. Verbose= Exiting with ExitCode=0 ========== Build: 3 succeeded or up-to-date, 0 failed, 0 skipped ==========