visual studio 2010 introduce finally a solution for the paradigma of test / live config files. the solution is a config transformation per xsl.
Step 1:
Once you have executed this you get 2 web.config files:
- web.debug.config
- web.release.config
if you want you have also the ability to add additional config files as long as you support the naming convention: web.integration.config. The files area actually only contain the changes and are not copies of you main config files.
Step 2:
so here an example how to manage that:
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/configuration/appSettings">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<xsl:element name="add">
<xsl:attribute name="key">NewSetting</xsl:attribute>
<xsl:attribute name="value">New Setting Value</xsl:attribute>
</xsl:element>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
more infos and samples can be found here.
No comments:
Post a Comment