asp.net - Web.config appSettings configSource 属性转换

标签 asp.net .net web-config

我正在尝试使用 web.config 转换更新我的 web.config 文件中 appSettings 元素上的 configSource 属性。

我的 web.config 中有以下内容

    <appSettings configSource="Config\appSettings.local.config">
    </appSettings>

我希望这是
    <appSettings configSource="Config\appSettings.prod.config">
    </appSettings>  

当我构建 Release 时。这不会发生。我的 Web.Release.config 元素中有以下内容
    <appSettings xdt:Transform="SetAttributes(configSource)" configSource="Config\appSettings.prod.config" />

最佳答案

转换仅在您部署 Web 应用程序(或创建部署包)时发生。当您简单地构建解决方案时,它不会发生。

http://msdn.microsoft.com/en-us/library/dd465326.aspx

“对于 Web 应用程序项目,ASP.NET 提供了在部署 Web.config 文件 时自动更改(转换)Web.config 文件 的过程的工具。”

关于asp.net - Web.config appSettings configSource 属性转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9585415/

相关文章:

.net - ASP.Net 程序员应该引用哪些其他框架来获得代码灵感?

c# - 读取命令行开关

c# - 在 web 配置中动态添加值?如何+最佳方式

azure - Azure 上的 nginx 配置

asp.net - 可以使用customErrors = On,但仅适用于非IIS处理的错误吗?

asp.net - ReaderWriterLockSlim 的 MSDN 示例用法是否包含死锁风险?

asp.net - SQL Server 和 ADO.NET 中事务的区别?

c# - 如何启动 Windows 窗体应用程序?

.net - .Net 中的数据库应用程序最佳实践

asp.net - 如何使用 ASP.NET MVC 进行异步/等待视频流?