locked
Web deployment project - web.config section replacement does not add remove tag RRS feed

  • Question

  • User-1515083661 posted

    I have a web application that is actually installed as a component of a third party site.  In some configurations, I need to remove certain connection strings and re-add them.  I'm replacing this web.config section with a xml file that includes the following:

    <connectionStrings>
          <remove name="MyOverridenConnection"/>
          <add connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDb;Data Source=MyServer" name="MyOverridenConnection"
               providerName="System.Data.SqlClient"/>
        </connectionStrings>

    For some reason the remove tag is left out during the substitution and I end up with the following in the installed config:

    <connectionStrings>
          <add connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDb;Data Source=MyServer" name="MyOverridenConnection"
               providerName="System.Data.SqlClient"/>
        </connectionStrings>

    Is there any way to issue removes in replaced sections or is this just not supported?

    Friday, August 6, 2010 11:11 AM

All replies

  • User-33420011 posted

    your remove command is alright, you are just missing the name see below:

    <connectionStrings>
    <remove name="MyOverridenConnection"/>
         <add name="MyOverridenConnection"
    connectionString="server=.\SQLEXPRESS;database=test;uid=test;password=test;"
    providerName="System.Data.SqlClient" />
    </connectionStrings>
    Friday, August 6, 2010 6:45 PM
  • User-1515083661 posted

    Ummm, maybe I'm missing something.  Except for the extra line after the remove, how does your remove differ from the one I listed in the source? 

    Tuesday, August 10, 2010 7:00 PM