进行持续集成时如何处理多个 Visual Studio 配置?
我在 Visual Studio 中设置了多个配置,以便我可以为多个客户之一构建一个解决方案(包含多个项目)。少量的 web.config 设置是根据客户定制的,并且代码构建到不同的“BuildDir”,以便我可以将其打包并交付。目前,这一切都是由我的开发计算机上的 Visual Studio 配置管理器与几个 Web 部署项目结合驱动的,我发现这非常脆弱。
我想实现一个 CI 服务器(CC.Net 或 TeamCity),但不确定如何最好地适应这种每客户端配置(或者我是否应该尝试)。我在分支中开发,并在每个功能完成后与主干重新集成。那么我认为 CI 服务器应该将代码集成到主干中是否正确?如果是这样,我如何处理每个客户的调试和发布版本?
我的配置是:
- 开发(调试)
- 测试(调试)
- UAT - Cust。 1(发布)
- 生产 - 客户。 1(发布)
- UAT - 客户。 2(发布)
- 生产 - 客户。 2(发布)
- 等。
除了每个客户的少量配置设置外,所有客户的产品几乎都是相同的。
我很想知道你对我如何设置这个的想法,或者我的想法是否错误?
谢谢。
I have multiple configurations set up in Visual Studio so that I can build one solution (containing multiple projects) for one of a number of customers. A small number of web.config settings are customized depending on the customer, and the code is built to a different 'BuildDir' so I can package it up and deliver it. At the moment this is all driven from the Visual Studio Configuration Manager on my dev machine in conjunction with a couple of Web Deployment Projects, and I'm finding this pretty fragile.
I want to implement a CI server (CC.Net or TeamCity) but am not sure how to best accommodate this sort of per-client configuration (or if I should be attempting to). I develop in a branch, and reintegrate with the trunk as each feature is completed. Am I correct in thinking then that the CI server should be integrating the code in trunk, and if so, how do I deal with debug and release builds for each customer?
My configurations are:
- Development (debug)
- Test (debug)
- UAT - Cust. 1 (release)
- Production - Cust. 1 (release)
- UAT - Cust. 2 (release)
- Production - Cust. 2 (release)
- etc.
Apart from the small number of configuration settings for each customer the product is pretty much the same for all of them.
I'm keen to get your thoughts on how I could set this up, or whether I'm thinking about this wrong?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们遵循两步构建过程:第一个解决方案是使用调试/发布配置正常构建。接下来(在构建完成过程之后),运行任务来转换 web.configs(如果是针对一个文件,但可以轻松修复它以处理一堆文件):
这样
1) 解决方案文件中只有两个有意义的配置
2)在构建服务器上,您传递两个属性:配置(例如发布)和WebConfiguration(例如UATCust2)
3) 此任务仅在构建服务器上运行,因为它是更大构建脚本的一部分:开发人员始终使用默认的调试/发布配置,目标平台配置可以单独存储,例如存储在存储库中的受保护部分中,甚至存储在网络上分享。
We adhered two-step building procedure: first solution is build normally with Debug/Release configuration. Next (after build completion procedure), task is run for transforming web.configs(this if for one file, but it can be easily fixed to handle bunch of them):
This way
1) You have only two meaningful configurations in solution file
2) On build server you're passing two properties: Configuration (e.g. Release) and WebConfiguration (e.g. UATCust2)
3) This task is only run on build server, as it is part of bigger build script: developers are always working with default Debug/Release configuration, target platform configurations can be stored separately, e.g. in protected section in repository, or even on network share.
我使用 UppercuT 解决了这个问题,RoundHouse 和 CC.Net,并通过更改我在 SVN 中分支和标记各种配置的方式。现在,我有了一个由 CC.Net/UppercuT 在构建服务器上自动构建的代码“主线”(主干),然后可使用 UppercuT 进行打包和部署。如果我需要构建特定客户的源代码,我可以获取他们的源代码,进行必要的更改,然后提交回他们的分支。然后在该分支内运行 UppercuT 会为该客户生成一个可部署的包。在我看来,UppercuT 和 NAnt 的组合比使用 VS2010 的配置管理器提供了更大的灵活性。
I solved this using UppercuT, RoundHousE and CC.Net, and by changing the way I branch and tag the various configurations in SVN. Now I have one 'mainline' of code (the trunk) that is automatically built by CC.Net/UppercuT on the build server and is then made available for packaging and deployment using UppercuT. If I need to build a specific customer's source, I can get their source, make the necessary change, and then commit back to their branch. Running UppercuT within that branch then produces a deployable package for that customer. The combination of UppercuT and NAnt provides much greater flexibility IMO that using VS2010's Configuration Manager.