版本控制:如何使编译后的代码库在多个web站点上保持最新?

时间:2021-02-24 20:09:45

Currently, we have a long list of various websites throughout our company's intranet. Most are inside a firewall and require an Active Directory account to access. One of our problems, as of late, has been the increase in the number of websites and the addition of a common code library that stores our database access classes, common helper functions, serialization methods, etc. The goal is to use that framework across all websites throughout the company.

目前,我们公司的内部网有一长串的网站。大多数都在防火墙内,需要一个活动目录帐户来访问。最近,我们的问题之一是网站数量的增加和一个通用代码库的增加,该库存储我们的数据库访问类、通用助手函数、序列化方法等。我们的目标是在整个公司的所有网站上使用这个框架。

Currently, we have upgraded the in-house data entry application with these changes consistently. It is up-to-date. The problem, however, is maintaining all of the other websites. Is there a best practice or way in which I find out versions on each website and upgrade accordingly? Can I have a centralized place where I keep these DLLs and sites reference them? What's the best way to go about finding out what versions are on these websites without having to go through each and every single website, find out the version, and upgrade after every change?

目前,我们对内部数据输入应用程序进行了升级,并始终保持这些更改。它是最新的。然而,问题是所有其他网站的维护。有没有最佳的实践或方法,我在每个网站上找到不同的版本并进行相应的升级?我可以在一个集中的地方保存这些dll和站点引用它们吗?什么是最好的方法去找出这些网站上有什么版本,而不需要浏览每一个网站,找出版本,并在每次修改后进行升级?

Keep in mind, we run the newest TFS and are a .NET development team.

记住,我们运行最新的TFS,并且是一个。net开发团队。

2 个解决方案

#1


2  

At my job we have a similar setup to you, lots of internal applications that use common libraries, and I have spent the best part of a year sorting this all out.

在我的工作中,我们有类似的设置,许多内部应用程序使用公共库,我花了一年的大部分时间来整理这些。

The first thing to note is that nothing you mentioned really has anything to do with TFS, but is really a symptom of the way your applications, and their components, are packaged and deployed.

首先要注意的是,您提到的任何东西都与TFS没有任何关系,但它实际上是您的应用程序及其组件打包和部署方式的一个症状。

Here are some ideas to get you started:

以下是一些让你开始的想法:

Setup automated/continuous builds

This is the first thing you need to do. Use the build facility in TFS if you must, or make the investment into something like TeamCity (which is great). Evaluate everything. Find something which you love and that everyone else can live with. The reason why you need to find something you love is because you will ultimately be responsible for it.

这是你需要做的第一件事。如果需要,可以在TFS中使用构建工具,或者向TeamCity(这很好)之类的东西进行投资。评估一切。找一些你喜欢的,其他人都可以一起生活的东西。你需要找到你喜欢的东西的原因是你最终会为此负责。

The reason why setting up automated builds is so important is because that's your jumping off point to solve the rest of your issues.

设置自动化构建如此重要的原因是,这是您解决其余问题的起点。

Setup automated deployment

Every deployable artifact should now be being built by your build server. No more manual deployment. No more deployment from workstations. No more visual studio Publish feature. It's hard to step away from this, but it's worth it.

现在应该由构建服务器构建每个可部署的工件。没有更多的手工部署。不再从工作站部署。不再有visual studio发布功能。要想摆脱这一点很难,但这是值得的。

If you have lots of web projects then look into either using web deploy which can be easily automated using either msbuild/powershell or go fancy and try something like octopus deploy.

如果您有很多web项目,那么可以考虑使用web部署(可以使用msbuild/powershell轻松自动化),或者尝试使用octopus deploy之类的东西。

Package common components using nuget

By now your common code should have its own automated builds, but how do you automatically deploy a common component? Package it up into nuget and either put it on a share for consumption or host it in a nuget server (TeamCity has one built in). A good build server can automatically update your nuget packages for you (if you always need to be on the latest version), and you can inspect which version you are referencing by checking your packages.config.

到目前为止,您的公共代码应该有自己的自动构建,但是如何自动部署公共组件呢?将其打包到nuget中,并将其放在共享中使用,或者将其托管在nuget服务器中(TeamCity内建了一个)。一个好的构建服务器可以自动为您更新nuget包(如果您总是需要更新最新版本),并且您可以通过检查packages.config来检查正在引用的版本。


I know this is a lot to take in, but it is in its essence the fundamentals of moving towards continuous delivery (http://continuousdelivery.com/).

我知道这需要付出很多,但从本质上来说,这是朝着持续交付前进的基础(http://continuousdelivery.com/)。

Please beware that getting this right will take you a long time, but that the process is incremental and you can evolve it over time. However, the longer you wait the harder it will be. Don't feel like you need to upgrade all your projects at the same time, you don't. Just the ones that are causing the most pain.

请注意,做对这件事需要很长一段时间,但是这个过程是渐进的,你可以随着时间的推移而发展。然而,你等待的时间越长,事情就越艰难。不要觉得你需要同时升级所有的项目,你不需要。就是那些造成最多痛苦的。

I hope this helps.

我希望这可以帮助。

#2


0  

I'd just like to step outside the space of a specific solution for your problem and address the underlying desire you have to consolidate your workload. Be aware that any patching/upgrading scenario will have costs that you must address - there is no magic pill. Particularly, what you want to achieve will typically incur either a build/deploy overhead (as jonnii has outlined), or a runtime overhead (in validating the new versions to ensure everything works as expected).

我只是想跳出为您的问题提供特定解决方案的空间,解决您需要整合工作负载的潜在愿望。请注意,任何补丁/升级方案都有您必须解决的成本——没有灵丹妙药。特别是,您想要实现的通常是构建/部署开销(如jonnii所描述的)或运行时开销(验证新版本以确保一切正常工作)。

In your case, because you have already built your products, I expect you will go the build/deploy route.

在您的案例中,因为您已经构建了您的产品,所以我希望您可以选择构建/部署路由。

Just remember that even with binary equivalence (everything compiles, and unit tests pass), there is still the risk that the application will behave somehow differently after an upgrade, so you will not be able to avoid at least some rudimentary testing across all of your applications (the GAC approach is particularly vulnerable to this risk).

记住,即使是二进制等价(一切都编译,单元测试通过),仍有风险,应用程序的行为在某种程度上不同的升级后,你将无法避免至少一些基本的测试应用程序的所有(海关总署的方法是特别容易受到这种风险)。

You might find it easier to accept that just because you have built a new version of a binary, doesn't mean that it should be rolled out to all web applications, even ones that are already functioning correctly (if something ain't broke...).

您可能会更容易接受这一点,因为您已经构建了二进制的新版本,但这并不意味着应该将它扩展到所有的web应用程序,即使是那些已经正常运行的应用程序(如果某些东西没有损坏…)。

If that is acceptable, then you will reduce your workload by only incurring resource expense on testing applications that actually need to be touched.

如果这是可以接受的,那么您将会减少您的工作负载,只会在实际需要被触摸的测试应用程序上花费资源费用。

#1


2  

At my job we have a similar setup to you, lots of internal applications that use common libraries, and I have spent the best part of a year sorting this all out.

在我的工作中,我们有类似的设置,许多内部应用程序使用公共库,我花了一年的大部分时间来整理这些。

The first thing to note is that nothing you mentioned really has anything to do with TFS, but is really a symptom of the way your applications, and their components, are packaged and deployed.

首先要注意的是,您提到的任何东西都与TFS没有任何关系,但它实际上是您的应用程序及其组件打包和部署方式的一个症状。

Here are some ideas to get you started:

以下是一些让你开始的想法:

Setup automated/continuous builds

This is the first thing you need to do. Use the build facility in TFS if you must, or make the investment into something like TeamCity (which is great). Evaluate everything. Find something which you love and that everyone else can live with. The reason why you need to find something you love is because you will ultimately be responsible for it.

这是你需要做的第一件事。如果需要,可以在TFS中使用构建工具,或者向TeamCity(这很好)之类的东西进行投资。评估一切。找一些你喜欢的,其他人都可以一起生活的东西。你需要找到你喜欢的东西的原因是你最终会为此负责。

The reason why setting up automated builds is so important is because that's your jumping off point to solve the rest of your issues.

设置自动化构建如此重要的原因是,这是您解决其余问题的起点。

Setup automated deployment

Every deployable artifact should now be being built by your build server. No more manual deployment. No more deployment from workstations. No more visual studio Publish feature. It's hard to step away from this, but it's worth it.

现在应该由构建服务器构建每个可部署的工件。没有更多的手工部署。不再从工作站部署。不再有visual studio发布功能。要想摆脱这一点很难,但这是值得的。

If you have lots of web projects then look into either using web deploy which can be easily automated using either msbuild/powershell or go fancy and try something like octopus deploy.

如果您有很多web项目,那么可以考虑使用web部署(可以使用msbuild/powershell轻松自动化),或者尝试使用octopus deploy之类的东西。

Package common components using nuget

By now your common code should have its own automated builds, but how do you automatically deploy a common component? Package it up into nuget and either put it on a share for consumption or host it in a nuget server (TeamCity has one built in). A good build server can automatically update your nuget packages for you (if you always need to be on the latest version), and you can inspect which version you are referencing by checking your packages.config.

到目前为止,您的公共代码应该有自己的自动构建,但是如何自动部署公共组件呢?将其打包到nuget中,并将其放在共享中使用,或者将其托管在nuget服务器中(TeamCity内建了一个)。一个好的构建服务器可以自动为您更新nuget包(如果您总是需要更新最新版本),并且您可以通过检查packages.config来检查正在引用的版本。


I know this is a lot to take in, but it is in its essence the fundamentals of moving towards continuous delivery (http://continuousdelivery.com/).

我知道这需要付出很多,但从本质上来说,这是朝着持续交付前进的基础(http://continuousdelivery.com/)。

Please beware that getting this right will take you a long time, but that the process is incremental and you can evolve it over time. However, the longer you wait the harder it will be. Don't feel like you need to upgrade all your projects at the same time, you don't. Just the ones that are causing the most pain.

请注意,做对这件事需要很长一段时间,但是这个过程是渐进的,你可以随着时间的推移而发展。然而,你等待的时间越长,事情就越艰难。不要觉得你需要同时升级所有的项目,你不需要。就是那些造成最多痛苦的。

I hope this helps.

我希望这可以帮助。

#2


0  

I'd just like to step outside the space of a specific solution for your problem and address the underlying desire you have to consolidate your workload. Be aware that any patching/upgrading scenario will have costs that you must address - there is no magic pill. Particularly, what you want to achieve will typically incur either a build/deploy overhead (as jonnii has outlined), or a runtime overhead (in validating the new versions to ensure everything works as expected).

我只是想跳出为您的问题提供特定解决方案的空间,解决您需要整合工作负载的潜在愿望。请注意,任何补丁/升级方案都有您必须解决的成本——没有灵丹妙药。特别是,您想要实现的通常是构建/部署开销(如jonnii所描述的)或运行时开销(验证新版本以确保一切正常工作)。

In your case, because you have already built your products, I expect you will go the build/deploy route.

在您的案例中,因为您已经构建了您的产品,所以我希望您可以选择构建/部署路由。

Just remember that even with binary equivalence (everything compiles, and unit tests pass), there is still the risk that the application will behave somehow differently after an upgrade, so you will not be able to avoid at least some rudimentary testing across all of your applications (the GAC approach is particularly vulnerable to this risk).

记住,即使是二进制等价(一切都编译,单元测试通过),仍有风险,应用程序的行为在某种程度上不同的升级后,你将无法避免至少一些基本的测试应用程序的所有(海关总署的方法是特别容易受到这种风险)。

You might find it easier to accept that just because you have built a new version of a binary, doesn't mean that it should be rolled out to all web applications, even ones that are already functioning correctly (if something ain't broke...).

您可能会更容易接受这一点,因为您已经构建了二进制的新版本,但这并不意味着应该将它扩展到所有的web应用程序,即使是那些已经正常运行的应用程序(如果某些东西没有损坏…)。

If that is acceptable, then you will reduce your workload by only incurring resource expense on testing applications that actually need to be touched.

如果这是可以接受的,那么您将会减少您的工作负载,只会在实际需要被触摸的测试应用程序上花费资源费用。