Use Web Deployment Projects To Replace Web.config Sections

In a comment to my Web
Application Settings in ASP.NET 2.0
article, I was asked about overriding
default web.config values by replacing external files using the file attribute,
as he could in .NET 1.1.  The web.config has several new sections, and none
support the ‘file’ attribute–instead, the configSource is used.  This
wasn’t so satisfactory to the commenter, so I recommended MS Build for the
task.

Over the weekend, I worked a little with Web
Deployment Projects
, and there is functionality to replace web.config
sections built in to the tool.  You could create several different build
configurations–Debug (Dev), Debug (Test), Release (Test), Release (Prod) for
your web application.  Then, create a different deployment project for each
build config, and specify different SMTP or connection strings as
necessary.  This is probably where the commenter wanted to go, but I found
this out a little too late.  Hope it helps someone else down the road,
though.

2 thoughts on “Use Web Deployment Projects To Replace Web.config Sections”

  1. Hi,

    I need your article to build my project. Could you please share with me?

    Thanks,
    Tom

Comments are closed.