using System;
namespace TestCoreLibrary
{
public class Foo
{
public void DoIt()
{
#if DEBUG
Console.WriteLine("DEBUG");
#else
Console.WriteLine("Release");
#endif
}
}
}
using System;
using TestCoreLibrary;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
#if DEBUG
Console.WriteLine("Main: DEBUG");
#else
Console.WriteLine("Main: Release");
#endif
new Foo().DoIt();
}
}
}
Other predefined symbols include the DEBUG and TRACE constants. You can override the values set for the project using #define. The DEBUG symbol, for example, is automatically set depending on your build configuration properties ("Debug" or "Release" mode).
I see that too for C# project, for VB.Net it is enabled by default.Why in a .NET Standard 2.0 Class Library in Debug in the BUILD section of the project properties is the DEBUG constant not checked?