How do I use Visual Studio 2010 config transformations for the applicationSettings section in the web.config file?

I just upgraded to Visual Studio 2010 and I am playing around with the Config transforms option for web application projects. I can see in the example file how to change the connection strings, but I want to change the settings in the applicationSettings (Not appsettings) section. I could not find information on this.

I tried the following which worked, but I thought there might be a better way:

  <applicationSettings>
    <MyDashboard.Web.Properties.Settings>
      <setting name="SomePath" serializeAs="String" xdt:Transform="Replace" xdt:Locator="Match(name)">
        <value>c:\somewhere test</value>
      </setting>
    </MyDashboard.Web.Properties.Settings>
  </applicationSettings>

      

+2


a source to share


2 answers


Try it. It will replace all applicationSettings node.



<applicationSettings xdt:Transform="Replace"> 
    <MyDashboard.Web.Properties.Settings> 
      <setting name="SomePath" serializeAs="String"> 
        <value>c:\somewhere production</value> 
      </setting> 
    </MyDashboard.Web.Properties.Settings> 
  </applicationSettings> 

      

+2


a source


Semi-link ... check the SlowCheetah VS add-in on ... visualstudiogallery



+1


a source







All Articles