Reputation:
In Visual Studio I can manually define a directive for debug using
#define DEBUG
// ...
#if DEBUG
Console.WriteLine("Debug version");
#else
Console.WriteLine("Release version");
#endif
Is there a way to link this to the solution configuration so when I select Debug/Release or a custom configuration it will auto define?
Upvotes: 6
Views: 3774
Reputation: 1910
In Properties->Build->Conditional compilation symbols. Define your directives and use in preprocessor conditionals.
Upvotes: 8