How do you deal with configuration files in source control?

前端 未结 19 2012
情书的邮戳
情书的邮戳 2020-11-27 13:00

Let\'s say you have a typical web app and with a file configuration.whatever. Every developer working on the project will have one version for their dev boxes, there will be

19条回答
  •  爱一瞬间的悲伤
    2020-11-27 13:38

    The solution we use is to have only the single configuration file (web.config/app.config), but we add a special section to the file that contains settings for all environments.

    There is a LOCAL, DEV, QA, PRODUCTION sections each containing the configuration keys relevant to that environment in our config file(s).

    What make this all work is an assembly named xxx.Environment which is referenced in all of our applications (winforms and webforms) which tells the application which environment it is operating on.

    The xxx.Environment assembly reads a single line of information from the machine.config of the given machine which tells it that it is on DEV, QA, etc. This entry is present on all of our workstations and servers.

    Hope this helps.

提交回复
热议问题