web.config and app.config machine-specific settings in git

后端 未结 5 1978
春和景丽
春和景丽 2021-01-30 13:47

We have multiple teams of developers in different offices, and they need different values for a number of configuration setting in our projects\' web.config and

5条回答
  •  自闭症患者
    2021-01-30 14:18

    I'd like to suggest you look at ConfigGen. We use it in all our projects, and it works wonders for all the developers and also for all our environments. It basically runs off a spreadsheet that states machine name and output configuration file, and then tokenises a template App.Config or Web.Config, substituting values from the spreadsheet into it. Add a simple pre-build step to your projects to run configgen, and before the build kicks off, you have a tailored configuration file for your machine. It also supports default settings.

    Take a look at the site and make your own mind up, but I can definitely vouch for it.

    EDIT: It's worth noting that you can then ignore all your Web.config and App.config files (in terms of .git). But you do need to add your templates and spreadsheets to the repo. Also, I am assured there is an update on the way that may well include an xml replacement for the spreadsheets, that has it's own editor, making it eminently more suitable for DVCS's.

    Edit2: Also take a look at Daniel's post here: https://stackoverflow.com/a/8082937/186184. He gives a very clear example of the template and spreadsheet, and how to get it working in your solution.

提交回复
热议问题