How to overcome endless problems with web.config when working with team?
I'm in a team of people 开发者_Python百科working from various places and on different machines. Everyone has it's own connection string, nhibernate setting (schema etc.) and wcf endpoints. What drives me crazy is that every now and then when someone adds new key to AppSettings section, my settings are overwritten by his. Does anyone know a way to somehow preserve or rather overwrite again certain web.config settings? Maybe somehow replace in on compile time and define them elsewhere?
Here is the approach we use. In source control we have file web.config.development
with common settings. Every developer on his machine has file web.config
which is basically a web.config.development
merged with developer's individual settings.
Whenever any common changes are made to the web.config.development
, their author announces that (via Skype, or email, etc.) and every developer merges these changes with his own web.config
. In most cases web.config
is not being changed very often, so this is not a time consuming work. However we were thinking about automating this process but have not come up with any good solution so far.
The key point here is that web.config
is not in the source control, it never was, it never will be. That guarantees that individual settings like connection strings won't be overridden accidentally.
P.S. One more point to be considered is the continuous integration (in case you have one). There we have added a step during deployment, on which web.config.development
is renamed into web.config
.
精彩评论