如何管理配置设置为每个开发人员 [英] How to manage Configuration Settings for each Developer

查看:81
本文介绍了如何管理配置设置为每个开发人员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个.NET项目,说你有一个配置设置 - 就像一个连接字符串 - 存储在app.config文件,这是对你的团队每个开发人员不同(它们可以使用本地SQL Server,或特定服务器实例,或使用远程服务器等)。

In a .NET project, say you have a configuration setting - like a connection string - stored in a app.config file, which is different for each developer on your team (they may be using a local SQL Server, or a specific server instance, or using a remote server, etc).

您如何构建您的解决方案,使每个开发者都可以有自己的发展preferences(即不签入源代码控制),但提供了已签入源代码管理(从而提供正确的默认连接字符串默认的构建过程,或新的开发者)。

How can you structure your solution so that each developer can have their own development "preferences" (i.e. not checked into source control), but provide a default connection string that is checked into source control (thereby supplying the correct defaults for a build process or new developers).


编辑:可以在文件的方法所建议 @Jonathon 以某种方式与<$使用C $ C>的ConnectionStrings 部分?


Can the "file" method suggested by @Jonathon be somehow used with the connectionStrings section?

推荐答案

的AppSettings可以与本地文件来覆盖:

AppSettings can be overridden with a local file:

<appSettings file="localoveride.config"/>

这使得每个开发人员,以保持自己的本地设置。

This allows for each developer to keep their own local settings.

至于连接字符串,在一个完美的世界上所有的开发人员应该连接到测试数据库,而不是运行SQL Server的每个。

As far as the connection string, in a perfect world all developers should connect to a test DB, not run SQL Server each.

不过,我发现它最好是保持一个名为Web.Config.Prd源控制文件,并利用它来进行构建部署。如果有人修改了web.config中,他们还必须添加换到.PRD文件......有没有好的自动化有:(

However, I've found it best to keep a file named Web.Config.Prd in source control, and use that for build deployments. If someone modifies web.config, they must also add the change to the .PRD file...There is no good automation there :(

这篇关于如何管理配置设置为每个开发人员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆