I wanna perform integration tests with specific settings, so I added new active solution configuration (Test) and also defined Web.Test.config in my MVC4 app. Does anybody know what else must I do, so then when I start website in Test mode, it loads correct
config file?
The web.config transformation works only when you deploy the project. In order to have a specific web.config file for a specific configuration (like, Integration, production, etc) you need to do a little trick. See here:
Please note that if you use TFS (or other source control) you need to select the web.config then File\Source Control\Exclude Web.config from Source Control (the variations Web.config.Debug, Web.config.Integration and so on can stay under source control).
Please click 'Mark as Answer' if my reply has assisted you
ErolFoo
Member
17 Points
27 Posts
Additional web.config setting
May 04, 2012 09:00 AM|LINK
Hello
I wanna perform integration tests with specific settings, so I added new active solution configuration (Test) and also defined Web.Test.config in my MVC4 app. Does anybody know what else must I do, so then when I start website in Test mode, it loads correct config file?
raduenuca
All-Star
24675 Points
4250 Posts
Re: Additional web.config setting
May 04, 2012 09:11 AM|LINK
The web.config transformation works only when you deploy the project. In order to have a specific web.config file for a specific configuration (like, Integration, production, etc) you need to do a little trick. See here:
http://www.hanselman.com/blog/ManagingMultipleConfigurationFileEnvironmentsWithPreBuildEvents.aspx
Please note that if you use TFS (or other source control) you need to select the web.config then File\Source Control\Exclude Web.config from Source Control (the variations Web.config.Debug, Web.config.Integration and so on can stay under source control).
Radu Enuca | Blog