VS2010清理Web.configs - 不更新

cw.*_*cw. 8 web-config visual-studio-2010 visual-studio

我在VS2010上搞乱MVC 2.0,并且在使用干净的Web配置功能时遇到了问题.

基本上在我的Web.debug.config我有

<connectionStrings xdt:Transform="Replace">
  <add name="ApplicationServices" 
    connectionString="Server=localhost;Database=SITE_DB;User ID=dbuser;Password=P@ssw0rd;Trusted_Connection=False;" />
</connectionStrings>

and in my `Web.config` I have

      <connectionStrings>
        <add name="ApplicationServices"
             connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
             providerName="System.Data.SqlClient" />
      </connectionStrings>
Run Code Online (Sandbox Code Playgroud)

当我以调试模式运行站点时,我希望xdt:Transform ="Replace"将用Web.debug.config中的内容替换整个connectionStrings部分.

我错了吗?或者我做其他事情是不正确的.没有太多信息张贴在这周围,我想我会问你们.

Jar*_*ing 11

只有在以某种方式发布或部署应用程序时才会发生.config转换.如果您只是调试,则不会发生转换.

这听起来很疯狂,但它直接来自MS代表的口:http: //forums.asp.net/p/1532038/3711423.aspx


sch*_*ode 0

我认为你需要将 xdt:Locator="Match(name)" 放入

<connectionStrings xdt:Transform="Replace" xdt:Locator="Match(name)">   
    <add name="ApplicationServices" 
      connectionString="Server=localhost;Database=SITE_DB;
      User ID=dbuser;Password=P@ssw0rd;Trusted_Connection=False;" 
     /> 
</connectionStrings>
Run Code Online (Sandbox Code Playgroud)