Click here to Skip to main content
15,884,388 members
Articles / Web Development / ASP.NET

Per developer configuration files (Visual Studio)

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
13 Sep 2010CPOL2 min read 11.1K   4  
Per developer configuration files (Visual Studio)

Configuration files (such as app.config, web.config, etc.) are very convenient, but it's a real pain to manage them in a collaborative environment.

Although Microsoft introduced web.config transforms in Visual Studio 2010, it suffers (stop me if I'm wrong) from several limitations:

In my case (a team with a dozen of .NET developers on several ASP.NET projects, with Visual Studio 2005 and SVN as source control) which is probably next to yours, each developer was changing his configuration files with his own values (connection string, debug mode, etc.) and was periodically committing his changes, making other developers lose their values or have conflicts while updating (XML is badly merged with SVN).

I solved this problem by using NANT (http://nant.sourceforge.net) in all our .NET projects (Visual Studio 2005), basically:

  1. Genuine configuration files (such as web.config in an ASP.NET project) are moved as templates in a subfolder
  2. Hard coded values must be replaced with ${your_property} properties
  3. Genuine configuration files must be ignored in your source control server
  4. Each developer should create his property file (whose name must include at least the current Windows username), with customized values for ${your_property} properties
  5. A NANT's build file must be created, it's aim is to load the current Windows username property file, then copy the templated configuration files to their genuine place (properties must be extended)
  6. NANT must be triggered during the Visual Studio's pre-build event, to execute the build file

That's all folk, now each developer can manage his own property file (which can be/must be stored in your source control server) independently of the machine he's logged (as long as the Windows username is the same of course!).

Depending on your needs, you can extend this principle with the machine name, the current configuration, etc.

You can contact me if you want further information.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer Stambia
France France
I'm a 39 year old team deputy CTO, living and working near Lyon (France)

I started to write softwares in the end of 90's, when I was a teenager.

I acquired several but complementary skills, mainly (but not only) on Microsoft's technologies and platforms : assembly (x86, 68k), C, C++, .NET/C#, JavaScript/HTML/CSS, PHP, DBMS (MySQL, Oracle, SQL Server, etc.), etc.

During 2007-2012, I was particulary active on .NET, ASP.NET, C#, SQL Server and ORM (NHibernate) with a growing time spent on architecture, technical management, code review, etc.

Since 2013, I'm a full-time development team leader/manager at Everial, I stopped development at work but still love to develop some personnal programs during my spare time, mainly for domotic purposes. I use to play with Arduino, ESP8266/NodeCmu, Raspberry PI... running them with some C++ and .NET Core.

My hobbies are futsal, badminton, motorcycle, Formula One, domotic, gardening... and software developement.

Comments and Discussions

 
-- There are no messages in this forum --