在解决方案属性中,我将Configuration设置为"release",用于我唯一的项目.
在主程序的开头,我有这个代码,它显示"Mode = Debug".我也在最顶端有这两行:
#define DEBUG
#define RELEASE
Run Code Online (Sandbox Code Playgroud)
我在测试正确的变量吗?
#if (DEBUG)
Console.WriteLine("Mode=Debug");
#elif (RELEASE)
Console.WriteLine("Mode=Release");
#endif
Run Code Online (Sandbox Code Playgroud)
我的目标是根据调试版本和发布模式为变量设置不同的默认值.
在编译期间,我可以做一个检查
#if DEBUG
Log("something");
#endif
Run Code Online (Sandbox Code Playgroud)
但是debug="false",在运行时期间检查是否在Web.config中设置是首选的是什么?