ASP.NET MVC 2中的Web.config转换和额外的Web.config文件
我正在尝试在.NET 4上运行的ASP.NET MVC 2项目中使用Web.config转换。但是,我遇到了一个问题:
// Root Web.config
<add name="MyDB" connectionString="default...default" />
// Root Web.Debug.config
<add name="MyDB" connectionString="debug...debug" xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
// Root Web.Release.config
<add name="MyDB" connectionString="release... release" xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
我一直收到这个错误:
警告源文档中的任何元素都不匹配'/ configuration / add [@ name ='MyDB']'C: filePath Web.Release.config
我将其缩小到Views文件夹中的Web.Config文件。如果我给它一个connectionString,比如根Web.config文件中的那个,那么一切都很好,但这意味着我必须维护两个Web.config文件。这有什么解决方案吗?难道我做错了什么?
没有找到相关结果
已邀请:
2 个回复
谷靛
是
的孩子你会做:
并在web.debug.config中
畦桨存灯