Visual studio Web.config从Web.Release.config中删除ConnectionString节点

Visual studio Web.config从Web.Release.config中删除ConnectionString节点,visual-studio,xslt,web-config,Visual Studio,Xslt,Web Config,我的Web.config中有此文件,因此我的服务将在本地运行: <connectionStrings> <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=IPADD;Initial Catalog=DB;Persist Security Info=True;User ID=UN;Password=PW" /> &

我的Web.config中有此文件,因此我的服务将在本地运行:

  <connectionStrings>

    <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=IPADD;Initial Catalog=DB;Persist Security Info=True;User ID=UN;Password=PW" />
  </connectionStrings>

我需要这个,因为Web.Debug.Config不工作。因此,当我发布时,我想删除这个字符串,因为它实际上是从父Web.config继承的

  <connectionStrings>
    <remove name="DefaultConnection"/>

  </connectionStrings>

这似乎不起作用。。。(它抛出一个
条目“DefaultConnection”已经添加。
错误)

我怎样才能删除它?XSLT

另外,我不能使用
clear/
,因为它删除了到成员资格提供程序的Machine.Config DB连接字符串,同时抛出了一个不同的错误,请在下面输入代码:

<connectionStrings>
      <add name="LocalizationDB" 
        xdt:Transform="Remove" xdt:Locator="Match(name)"/>
</connectionStrings>
但是如果您有活动的“Debug”,您将有
Web.Debug.config
而不是
Web.Release.config

放在下面的代码中:

<connectionStrings>
      <add name="LocalizationDB" 
        xdt:Transform="Remove" xdt:Locator="Match(name)"/>
</connectionStrings>
但是如果您有活动的“Debug”,您将使用
Web.Debug.config
而不是
Web.Release.config