2

I have a config that has multiple connection strings. They all point to the same database server. Is there a way to replace a portion of the web.config, i.e.

<connectionStrings>
<add name="Conn1" connectionString="...DataSource=server1;Initial Catalog=DBName..." />
<add name="Conn2" connectionString="...DataSource=server1;Initial Catalog=DBName2..." />
</connectionStrings>

I want to change server1 with server 2. I could do this...

<add xdt:Transform="SetAttributes" xdt:Locator="Match(name)" name="Conn1" connectionString="...DataSource=server2;Initial Catalog=DBName..." />
<add xdt:Transform="SetAttributes" xdt:Locator="Match(name)" name="Conn2" connectionString="...DataSource=server2;Initial Catalog=DBName..." />

but wanted to see if there was a more all-inclusive way.

user472292
  • 1,069
  • 2
  • 22
  • 37

1 Answers1

0

According the msdn documentation of web.config transformation there is no possibility for this kind of transformation. You can only do Replace, Insert, InsertBefore, InsertAfter, Remove, RemoveAll, RemoveAttributes and SetAttributes transformations.

Wessel Kranenborg
  • 1,400
  • 15
  • 38