Semi-editable Files (eg config files) and version control - best practices?

后端 未结 8 2224
深忆病人
深忆病人 2020-12-30 17:17

So, I killed the build today by checking in a config file. It knows where the server is (think SQL server or the like), and I\'ve been working against the server which runs

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-30 17:57

    What you can do is have a default config file that stays unchanged, unless some new config is added. Then you have a different file that overrides the default file's configs.

    config.Default.xml
    config.User.xml
    

    Only config.Default.xml is source controlled. config.User.xml contains only the configurations that are different for you. So, say you are testing on a local SQL server, you put only the connection string in there and it will override the config.Default connection string.

    Take a look at .Net Framwork Application Configuration, it does most (if not all) of the work for you.

提交回复
热议问题