views:

261

answers:

1

I just upgraded to Visual Studio 2010, and I am playing around with the Config transforms option for web application projects. I see in the example file how to change the connection strings, but I want to change settings in the applicationSettings (Not appsettings) section. I have not been able to find any 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>
+1  A: 

Try this. It will replace all the 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> 

Regards.

Zubeyir
Thanks, it worked!
BigJoe714
I just wanted to mention that there is a known issue with this method which puts a line break after the new value, this caused problems for me, however the is a workaround posted here which worked flawlessly: http://connect.microsoft.com/VisualStudio/feedback/details/544183/web-config-transform-writes-extra-line-break-spaces-to-values-elements-under-applicationsettings-section#
BigJoe714