我正在尝试使用 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/