Project DescriptionMSBuild Task makes it easier with maintaining app.config and web.config across multiple projects, and build configurations.
Create one app.config/web.config template and share it across multiple projects with different configurations for each build target.
Supports
* Recursive configuration transformations, i.e. one configuration variable referencing another variable
* Nested configurations - i.e. one configuration inheriting from another
* Simple value transformations
* Full element transformations
Follow me on twitter to get updates
@bjornbsmith or check out my
blog where I also write about this project and other stuff.
Examples
Config template
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="HostName" value="$(HostName)"/>
<add key="DeploymentPath" value="$(DeploymentPath)"/>
</appSettings>
<!--$(Diagnostics)-->
<!--$(ServiceModel)-->
<system.web>
<compilation debug="$(Debug)"/>
</system.web>
</configuration>
base settings file (config.base.config)
<?xml version="1.0" encoding="utf-8" ?>
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="config.xsd">
<add key="HostName" value="http://localhost" overwritable="true"/>
<add key="DeploymentPath" value="$(HostName)/invalid" overwritable="true"/>
<addsection key="ServiceModel" overwritable="true">
<value><![CDATA[<system.serviceModel/>]]></value>
</addsection>
<addsection key="Diagnostics" overwritable="true">
<value><![CDATA[<system.diagnostics/>]]></value>
</addsection>
</settings>
environment specific settings file (config.Debug.config)
<?xml version="1.0" encoding="utf-8" ?>
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="config.xsd">
<add key="HostName" value="http://localhost" overwritable="true"/>
<add key="DeploymentPath" value="$(HostName)/debug" overwritable="true"/>
<add key="Debug" value="true"/>
<addsection key="Diagnostics" overwritable="true">
<value>
<![CDATA[<system.diagnostics>
<sources>
<source name="System.ServiceModel">
<listeners>
<add name="ConsoleListener"/>
</listeners>
</source>
</sources>
</system.diagnostics>]]></value>
</addsection>
<addsection key="ServiceModel" overwritable="true">
<value><!-- No service model required--></value>
</addsection>
</settings>