I am using MVC3, and I am wondering what is the best way to distinguish your environment? For instance I am thinking of adding a key to appSettings and referencing it, however in MVC3 is there a better way? I am working on 3 environments: Development, Staging, and Production.
Thanks
I use the configuration manager and define DEBUG, TEST, RELEASE as compile time constants. For configurations I use Web.config Transformation Syntax for Web Application Project Deployment and would highly recommend using them.
For example:
Test transformation:
When I change my configuration from debug to test and rebuild/deploy my app now uses the transformation update in my
web.Test.config
. Extremely useful.You can build different configurations using the Configuration Manager Dialog Box. At anytime you can right click on the web.config and select Add Config Transformations to have Visual Studio 2010 create the transformation config files automagically.