Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to switch configuration between Development/UAT/Prod environments in ASP.NET?

I need to switch among 3 different environments when developing my web app - Development, UAT, and Prod. I have different database connections in my configuration files for all 3. I have seen switching these settings done manually by changing all references and then rebuilding the solution, and also done with preprocessor directives. Is there an easy way to do this based on some variable so that the configuration doesn't have to be revised when deploying to a new environment every time?

like image 306
Mark Struzinski Avatar asked Sep 25 '08 12:09

Mark Struzinski


1 Answers

To me it seems that you can benefit from the Visual Studio 2005 Web Deployment Projects.

With that, you can tell it to update/modify sections of your web.config file depending on the build configuration.

Take a look at this blog entry from Scott Gu for a quick overview/sample.

like image 143
Magnus Johansson Avatar answered Nov 11 '22 19:11

Magnus Johansson