繁体   English   中英

C#预处理器指令链接到解决方案配置

[英]C# Preprocessor Directives linked to solution configuration

在Visual Studio中,我可以手动定义调试使用的指令

#define DEBUG
// ...
#if DEBUG
    Console.WriteLine("Debug version");
#else
    Console.WriteLine("Release version");
#endif

有没有办法将其链接到解决方案配置,所以当我选择Debug / Release或自定义配置时,它会自动定义?

在Properties-> Build-> Conditional compilation symbols中。 定义指令并在预处理器条件中使用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM