使用版本控制时处理多台计算机上的web.config差异 [英] Handling web.config differences across multiple machines when using version control

查看:93
本文介绍了使用版本控制时处理多台计算机上的web.config差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确定每个人都必须应对这些情况,我们签入源代码控制解决方案,每台开发机将拥有自己的调试,构建和测试资源.

I'm sure everyone has to deal with these situations, we check in our solution to source control and each dev machine will have its own resources for debugging, building and testing..

最常见的是:

  • Web服务器(IIS)
  • 数据库(SQL)

Web服务器易于操作,每台开发机都会有自己的proj.user文件来指定不同的调试信息.

The web server is easy to handle, each dev machine will have its own proj.user file to specify different debug information.

但是应用程序的连接字符串存储在web.config(受源代码控制)中,理想情况下,我们不希望web.config处于感知"状态,因此必须在配置部分进行委派到其他配置文件(不在sc下)不是最好的解决方案.

But connection strings for the app are stored in the web.config (which is under source control), ideally we don't want the web.config to be 'aware', so having to do config sections where we delegate them to other config files (not under sc) wouldn't be the best solution..

asp.net(.net?)已经支持一个具有web.config继承的模型,这是理想的情况..但是,这仅适用于目录.

asp.net (.net?) already supports a model to have web.config inheritance, which would be an ideal scenario.. however this only works for directories.

如果可以的话,那就太好了

It would be great if we could have

  • web.config<-在版本控制下
  • web.machine.config<-不受版本控制

我当然愿意为人们如何解决这个问题提供更好的建议.

Of course I'm open for better suggestions of how people solve this problem.

就像..也许有:

  • web.base.config<-在版本控制下
  • web.machine.config<-不受版本控制

并且有一个通过合并它们来创建web.config的构建脚本吗?

And having a build script that creates a web.config by merging them?

预先感谢, 斯蒂芬.

修改

看起来像下一个vs可能有解决此问题的方法:

Looks like the next vs may have a way to handle this:

http://blogs.msdn.com/webdevtools/archive/2009/05/04/web-deployment-web-config-transformation.aspx

编辑编辑

今天可能与xml大量更新兼容:

Possibly do'able with xml mass update today:

编辑编辑编辑

使用简单的xslt构建任务和复制所有内容并拦截某些属性的小型转换当然可以做到这一点.只是尝试了概念验证,这将为我们节省很多挫败感,但是转换文件可能更多而不是人们愿意接受的.

Well its certainly possible to do with a simple xslt build task and a small transform that copied everything and intercepts certain properties.. just tried a proof of concept and this will save us lots of frustration, but the transformation file may be more than people are willing to accept.

基本上,我们将Web.base.config存储在版本控制中,并通过转换运行它以在构建事件上生成Web.config.

Basically we store a Web.base.config in version control, and run it through the transform to generate the Web.config on a build event.

vs2010这样的版本在提供更友好的版本方面确实很有帮助.

Seems like vs2010 will really help in terms of having a much more friendly version of this.

推荐答案

VS 2010将为您提供大量控件来管理各种配置的web.config文件...

VS 2010 will provide you with a lot of control to manage web.config files for various configurations... Please check out.

这篇关于使用版本控制时处理多台计算机上的web.config差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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