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

标签 c# .net app-config configuration-files

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

我在 C# 代码中执行以下操作,我也想在我的 app.config 文件中执行类似的操作。

#if (Debug)
.......
#else
.....
#endif

最佳答案

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

或者有多个 app.config 文件,例如 app.config.debugapp.config.release,并在你的构建。

关于c# - 我可以在 app.config 文件中添加条件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5087134/

相关文章:

c# - 每个开发人员对 c# 类库的不同配置设置

c# - 如何在 app.config 文件中设置相对路径?

c# - 如何在 C# 中传递 const 引用?

c# - 调用类型参数的方法

c# - 无法在单元测试中加载文件或程序集“System.Web.Mvc”

.net - 从命令行运行垃圾收集器?

javascript - 从 JQuery 函数获取数组到后面的 C# 代码

c# - Azure Service Fabric 持续集成在 Visual Studio Team Services 中失败(以前是 VSO)

c# - FileSystemWatcher 不会在一段时间后触发

C#如何在app.config文件中指定appData文件路径