user857521
user857521

Reputation:

C# Preprocessor Directives linked to solution configuration

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

Answers (1)

Exploding Kitten
Exploding Kitten

Reputation: 1910

In Properties->Build->Conditional compilation symbols. Define your directives and use in preprocessor conditionals.

Upvotes: 8

Related Questions