How can I detect Debug or Release mode from command line pre-build or post-build window?
I tested the code below, it works in code text window. Can it be convert to command line code? If can, how to do it, thanks.
bool debugging = false;
#if DEBUG
debugging = true;
// do something like to move ../debug/bin/ to somewhere.
#else
debugging = false;
// do something like to move ../debug/bin/ to somewhere.
#endif
Console.WriteLine(debugging);
You can check the value of the $(ConfigurationName)
variable.
It is different to what you used in your code sample. #if DEBUG
is a conditional compilation directive which depends upon whether DEBUG
has been defined as a symbol or not. The ConfigurationName
variable depends upon what build configuration you have specified (which is independent of the conditional compilation symbols).