I have an application that is being run as a post-build event:
Project Properties -> Build Events: call "$(TargetDir)\bin\myApp.exe" "$(ProjectPath)"
However, sometimes I will run it by itself - sometimes from Visual Studio and sometimes straight from the console.
How can I tell programmatically if an application is being run as a post/pre-build event or standalone (so sometimes there will still be debugger attached, but not always)?
Is there some kind of flag or environment variable I can check?
Note: I want to check this from within the application that is being run.
The following will tell you if the debugger is attached.