Best practice for web.config handling in SCM.

Vote:
 
Hi! Anyone got a best practice for handling web.config in a source change management system (like Perforce or other)? An optimal solution for me would be if EPiServer would work like ASP.NET with the posibility to specify a second configuration file which stores system specifik data (). However it does not. If anybody has any suggestions I would greatly appreciate it. Thanks in advance! Pontus
#12937
Feb 15, 2007 12:00
Vote:
 
Hi, this is a very good question, and unfortunatly I have no good answers. If you google "appSettings file" you'll find many good discussions on best practices for handling this kind of problems, specifically for dev / test / production. I've seen some suggestions on naming your web.config files like .web.config and using scripts to copy the correct file to the site. It needs to be automatic, or at least semi-automatic to avoid problems and confusion. The machine specific versions should be committed to source control, and all global changes should be applied to all files during development to keep the files in sync. As you write, the version does not work very well for EPiServer sites. This is a pity, as this could have been a smart way of having local overrides of settings. The beauty of this feature is that the settings in the mydevappsettings.config will take precedense over the ones in web.config. So, I could have default (production?) settings in web.config, but my own local overrides in my file (not necessarily under source control). I did some quick tests, and this is what I found with this setting in web.config: I also added a key to web.config and appsettings.config: web.config: appsettings.config: From code I did some tests: System.Web.Configuration.WebConfigurationManager.AppSettings["MySetting"] --> "appsettings.config" Global.EPConfig["MySetting"] --> "web.config" ConfigurationSettings.AppSettings["MySetting"] --> "appsettings.config" So, for your own code, you can use this feature, as long as you do not use the ApplicationConfiguration class in EPiServer (Global.EPConfig and PageBase.Configuration). Unfortunatly, EPiServer uses its own reader to get the values from web.config (the web.config file is read and parsed as a ordinary xml file), which is why this does not work with the EPiServer settings. I know that the config system in EPiServer is getting an overhaul in 5.0, but I don't know if the file attribute on the appSettings element or the configSource attribute on all config sections will be supported. Hope so :-) /Steve
#15122
Feb 16, 2007 15:14
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.