views:

489

answers:

1

Hi folks,

I've got a simple ASP.NET MVC website. It has Debug, Testing and Release configuration modes.

We're using TFS as our source control and bug tracking, etc. Nice.

Now, we're about to embark on using Team Builds to automate some Continuous Intergration. The thing is, we're not sure how to make it so that if we want to make a DEBUG build, or a RELEASE build, it also drops the correct web.config file into the destination directory. Also, we have certain sections of the web.config file extracted to seperate files (eg. the connection string section or the machine key section, etc). Can the correct environment files be dropped correctly into the destination directory.

+2  A: 

You could do a pre-build step

Say you have checked in

  • /Debug.Web.Config
  • /Release.Web.Config

You could write a pre-build step to check the build type and copy the proper .config file to

  • /Web.Config

Something like

cp $(ConfigurationName).Web.Config $(TargetDir)

On a side note, ASP.net 4.0 will have support for multiple Web.Configs

http://weblogs.asp.net/gunnarpeipman/archive/2009/06/03/visual-studio-2010-multiple-web-config-versions.aspx

TJB
Love the new stuff coming in VS2010, etc :) With your idea above, this just copies our file OVER the web.config file in the destination (using cp command) so the original web.config is not messed with, right?
Pure.Krome
Yeah, i guess this way you wouldn't even have a web.config in your project, there would just be debug.web.config and release.web.config and then whenever you build the proper web config would be put in its place. But yes, your source web config shouldn't get messed with ;) of course this isn't tested so make sure everything is going in the right directories and what not.
TJB