Advanced Config Transforms

Jan 14, 2011 at 4:15 PM

Is there anyway to do config file transforms for the situation where a particular section might be sourced?

For example, if I have a web.config.transform like:

<configuration>
	<connectionStrings>
		<add name="Metadata" connectionString="Data Source=<My Connection String>;MultipleActiveResultSets=True;Application Name=Origin" providerName="System.Data.SqlClient"/>
	</connectionStrings>
</configuration>

and I run that on a web project that has the connection strings sourced, I'll get:

<connectionStrings configSource="Config\ConnectionStrings.config">
       <add name="Metadata" connectionString="<Connection Info>" />
</connectionStrings>

However, this is an invalid web config file.

Additionally, if I did a transform to make the ConnectionStrings sourced in webconfig, I'd break anyone that wasn't using sourced connection strings.

Is there any way that I can write a transform that will add the data to the right spot?

Jan 14, 2011 at 9:13 PM
Good point. I believe right now that will not work?

We should probably note that it won't work with pointing to subordinate configuration files for now, and perhaps explore this idea a little further.
____
Rob
"Be passionate in all you do"

http://devlicio.us/blogs/rob_reynolds
http://ferventcoder.com
http://twitter.com/ferventcoder