[英]C# : how to obtain solution configuration options?
Solution configuration I now do is a performance test, only used in the debugging phase.Need to manually adjust the #define when deployed。方案配置我现在做的是性能测试,只在调试阶段使用,部署时需要手动调整#define。
Whether can debug or release through solution configuration, to determine the #define code execution。是否可以通过方案配置调试或发布,来确定#define代码执行。
Through what way can, do not need to manually adjust the #define, to control code execution。通过什么方式可以,不需要手动调整#define,来控制代码执行。
If I didn't describe clearly, please leave a message to tell me如果我没有描述清楚,请留言告诉我
"Need to manually adjust the #define when deployed" “部署时需要手动调整#define”
You cannot do this.你不可以做这个。 #define
statements are processed by the compiler. #define
语句由编译器处理。
There are a number of possible solutions to your problem depending on what it actually is.您的问题有多种可能的解决方案,具体取决于问题的实际情况。
You can create multiple build configurations with different code in the #define
blocks and deploy each configuration to test.您可以在#define
块中使用不同的代码创建多个构建配置,并将每个配置部署到测试中。
or或者
You can use feature switches, which is just a way to turn on and off bits of code depending on, for example, settings in a configuration file.您可以使用功能开关,这只是一种根据例如配置文件中的设置来打开和关闭代码位的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.