Eric's Blog

Day to day experience in .NET
Welcome to Blogs @ IRM Sign in | Join | Help
 Search

Disclaimer

The content of this site is my own personal opinion and does not in any way represent my employer, it's subsideries or affiliates. These postings are provided "AS IS" with no warranties, and confer no rights.

This Blog

Modifying the Configuration File as Part of the Build

A common problem is the need of different configurations in development, test and production environments. For example it's very common to have different databases, and therefore its necessary to modify the connectionStrings section when moving from development to test. Visual Studio 2005 Web Deployment Projects contains a solution for this, but since it's a MSBuild tasks it is also useful in other deployment scenarios, than just web projects. The build task is called ReplaceConfigSections and can be found in Microsoft.WebDeployment.Tasks.dll assembly. To be able to use it in for example a winform project, it's necessary to manually modify the project file (which is a MSBuild file) and add a UsingTask and then later use it in the build.
 
<UsingTask
      Taskname="ReplaceConfigSections"
      AssemblyFileName="[Path]\Microsoft.WebDeployment.Tasks.dll" />
 
For a complete example check out Brennan's Blog post "Post Build Deployments with MSBuild". To learn more about Web Deployments Projects Fritz Onion's MSDN Magazine article is a good start.
Published den 16 januari 2008 11:40 by ericqu

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server, by Telligent Systems