How to Publish ASP.NET Web Site with Alternate Configuration Settings

I am working on a web project as a website, not a web application. How can I use a different config file depending on where it is hosted, so the local version uses my local SQL installation, but the published version uses a live database? e.g. connectionStrings.config is ignored (not published), connectionStrings.live.config is published as connectionStrings.config

I see a policy file setting, could this be something capable?

+1


a source to share


4 answers


There are several options for this. The easiest way is to use a web deployment project. ScottGu's post is detailed in this question.

For large projects, you need something like Nant or MSBuild and CruiseControl or TeamBuild.



I also posted something here when supporting complex configuration deployments

+3


a source


Use MSBuild or NAnt script for different builds.



+3


a source


You can use a web deployment project. Post ScottGu blog post .

+2


a source


Post a build event that changes configuration?

you may have a different message build event depending on your build config, each can copy a different config if needed.

+1


a source







All Articles