Managing differences in configuration files between development and production servers using SVN

I have several .NET application files that are different on the production server from the development server. For instance:

  • Web.config
  • MasterPage.master
  • account /account.aspx
  • Blog /Web.config
  • and a few more ...

What is the best way to manage these differences with SVN? I heard everything from saving the configuration folder on the trunk to creating a branch with "different" files, and then merging them with the release tag.

I use the SVN trunk for core development (stable) and mark the trunk when it is ready for release. The tube is deployed to my development server, and the release tag is deployed to the production server via FTP.

+4
source share
2 answers

One option is to leave this to the build / deploy process.

So, for Web.config you will have the following in SVN: Web.config (this may be your development version) Web.config.qa (if you have a qa environment) Web.config.prod

At the time of assembly / deployment, the deployment process β€œknows” to which environment it is being deployed (based on the fact that you control this - environment variables, script parameters, etc.) and replaces the correct configuration file in its place.

I prefer this method because it leaves your directory and file structure intact (and also has a configuration folder), and also avoids unnecessary branches and merging. This requires diligence to ensure that all files are updated when changes are made that are not environmentally specific, but you will pay this price regardless of strategy.

+1
source

Visual Studio 2010 added Web.config transformations, and in 2012 they added the ability to perform transformations in all configuration files. Thus, the correct configuration files are generated when published in this environment. The following is information about the built-in parameters: http://msdn.microsoft.com/en-us/library/dd465326.aspx

You can also use the excellent XML SlowCheetah extension: http://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5

As a result, you will have files Web.config.dev, Web.config.prod, tranform, which are automatically launched during deployment, all of them can be stored under version control without the need for branching, merging, difference, etc.

0
source

Source: https://habr.com/ru/post/1342231/


All Articles