我可以在app.config文件中添加条件吗?

Cha*_*thJ 17 .net c# app-config configuration-files

是否可以在app.config文件中添加条件?

我在下面的C#代码中做了,我app.config也希望在我的文件中做类似的事情.

#if (Debug)
.......
#else
.....
#endif
Run Code Online (Sandbox Code Playgroud)

mel*_*okb 10

您可以尝试某种类型的app.config转换:http://fknut.blogspot.com/2009/11/appconfig-transformation-with-new.html.

或者有多个app.configapp.config.debug和的文件app.config.release,并在您的构建中使用适当的文件.