如何在Visual Studio 2010中管理不同版本的支持DLL?

时间:2023-01-06 11:29:53

I have a VB.NET/C# Visual Studio 2010 Solution with a bunch of projects that depend on about 30 third-party DLLs all from 1 vendor. This third-party vendor recently released a new version of their software so I would like to parallel test their new software and my enhancements until I am comfortable to switch over. What is the best way to setup a solution in Visual Studio 2010 so that I can use the code I have developed on top of these third-party DLLs and have the opportunity to easily switch between:

我有一个VB.NET / C#Visual Studio 2010解决方案,其中包含大量项目,这些项目依赖于来自1个供应商的大约30个第三方DLL。这个第三方供应商最近发布了他们软件的新版本,所以我想并行测试他们的新软件和我的增强功能,直到我很乐意切换。在Visual Studio 2010中设置解决方案的最佳方法是什么,以便我可以使用我在这些第三方DLL上开发的代码,并有机会轻松切换:

(1) the new version of the third-party DLLs [for my testing] and
(2) the old version of the third-party DLLs in case I need to debug some problem a user is having

(1)新版本的第三方DLL [用于我的测试]和(2)旧版本的第三方DLL,以防我需要调试用户遇到的一些问题

Third party assemblies ARE NOT in GAC (they're currently in a folder on a network drive). They are NOT strongly signed (ran sn -vf ). They are changing from version 5.4.618.0 to 5.4.619.60.

第三方程序集不在GAC中(它们当前位于网络驱动器上的文件夹中)。它们没有强烈签名(运行sn -vf)。它们从版本5.4.618.0更改为5.4.619.60。

3 个解决方案

#1


1  

The way we handle this is to create an Assemblies folder associated with the project/solution at the file system level.

我们处理此问题的方法是在文件系统级别创建与项目/解决方案关联的Assemblies文件夹。

Whenever we have third-party DLLs that we need to use, they go into this folder and the reference in the projects are made to the files in the folder, not to the versions in GAC.

每当我们需要使用第三方DLL时,它们都会进入此文件夹,项目中的引用将发送到文件夹中的文件,而不是GAC中的版本。

This allows us to update dev machines with new releases and test them. Since all of our code, including the assemblies, are stored in subversion, if we need to test a version that the customer is having problems with, we check that release out of subversion into a different directory and we have an exact replica of what the customer is using.

这允许我们用新版本更新dev机器并测试它们。由于我们所有的代码(包括程序集)都存储在subversion中,如果我们需要测试客户遇到问题的版本,我们会将subversion的版本检查到不同的目录中,并且我们有一个完全复制的版本客户正在使用。

We've been doing this for about 8 years on some very large projects and it has worked very, very well for us.

我们已经在一些非常大的项目上做了大约8年,它对我们来说非常非常好。

#2


0  

You can use binding redirect and codebase combination to logically group the assemblies. It also helps in the case where you need to support multiple versions of same assembly. If the assembly is not strongly named or is not found in the GAC, the runtime looks for applicable codeBase elements in your machine and application configuration files. The codeBase element maps an assembly name to a file or a uniform resource locator (URL). If the assembly is strongly named, codeBase can refer to any location, including Internet-based URLs; otherwise, codeBase must refer to a directory relative to the application directory.

您可以使用绑定重定向和代码库组合对程序集进行逻辑分组。在需要支持同一程序集的多个版本的情况下,它也有帮助。如果程序集没有强名称或在GAC中找不到,则运行时会在计算机和应用程序配置文件中查找适用的codeBase元素。 codeBase元素将程序集名称映射到文件或统一资源定位符(URL)。如果程序集具有强名称,则codeBase可以引用任何位置,包括基于Internet的URL;否则,codeBase必须引用相对于应用程序目录的目录。

In case of Windows Workflow it is very common to have multiple versions of workflow, executing side by side. In that case the assemblies are strongly named and then appropriate entries are added in codebase section of web.config file. You can check out any standard documentation on WF and see as how it is implemented.

对于Windows Workflow,通常会有多个版本的工作流,并排执行。在这种情况下,程序集具有强名称,然后在web.config文件的codebase部分中添加适当的条目。您可以查看有关WF的任何标准文档,并了解它是如何实现的。

#3


0  

If there is simply a minor version change and these haven't been signed, then you can just swap out the libraries. Otherwise you will need to add bindings redirectsin your app.config to point a prior reference to the new version or just create a second project file with the updated references in it for your second folder.

如果只是一个次要的版本更改并且这些尚未签名,那么您可以只更换库。否则,您需要在app.config中添加绑定重定向以指向新版本的先前引用,或者只创建第二个项目文件,其中包含第二个文件夹中的更新引用。

#1


1  

The way we handle this is to create an Assemblies folder associated with the project/solution at the file system level.

我们处理此问题的方法是在文件系统级别创建与项目/解决方案关联的Assemblies文件夹。

Whenever we have third-party DLLs that we need to use, they go into this folder and the reference in the projects are made to the files in the folder, not to the versions in GAC.

每当我们需要使用第三方DLL时,它们都会进入此文件夹,项目中的引用将发送到文件夹中的文件,而不是GAC中的版本。

This allows us to update dev machines with new releases and test them. Since all of our code, including the assemblies, are stored in subversion, if we need to test a version that the customer is having problems with, we check that release out of subversion into a different directory and we have an exact replica of what the customer is using.

这允许我们用新版本更新dev机器并测试它们。由于我们所有的代码(包括程序集)都存储在subversion中,如果我们需要测试客户遇到问题的版本,我们会将subversion的版本检查到不同的目录中,并且我们有一个完全复制的版本客户正在使用。

We've been doing this for about 8 years on some very large projects and it has worked very, very well for us.

我们已经在一些非常大的项目上做了大约8年,它对我们来说非常非常好。

#2


0  

You can use binding redirect and codebase combination to logically group the assemblies. It also helps in the case where you need to support multiple versions of same assembly. If the assembly is not strongly named or is not found in the GAC, the runtime looks for applicable codeBase elements in your machine and application configuration files. The codeBase element maps an assembly name to a file or a uniform resource locator (URL). If the assembly is strongly named, codeBase can refer to any location, including Internet-based URLs; otherwise, codeBase must refer to a directory relative to the application directory.

您可以使用绑定重定向和代码库组合对程序集进行逻辑分组。在需要支持同一程序集的多个版本的情况下,它也有帮助。如果程序集没有强名称或在GAC中找不到,则运行时会在计算机和应用程序配置文件中查找适用的codeBase元素。 codeBase元素将程序集名称映射到文件或统一资源定位符(URL)。如果程序集具有强名称,则codeBase可以引用任何位置,包括基于Internet的URL;否则,codeBase必须引用相对于应用程序目录的目录。

In case of Windows Workflow it is very common to have multiple versions of workflow, executing side by side. In that case the assemblies are strongly named and then appropriate entries are added in codebase section of web.config file. You can check out any standard documentation on WF and see as how it is implemented.

对于Windows Workflow,通常会有多个版本的工作流,并排执行。在这种情况下,程序集具有强名称,然后在web.config文件的codebase部分中添加适当的条目。您可以查看有关WF的任何标准文档,并了解它是如何实现的。

#3


0  

If there is simply a minor version change and these haven't been signed, then you can just swap out the libraries. Otherwise you will need to add bindings redirectsin your app.config to point a prior reference to the new version or just create a second project file with the updated references in it for your second folder.

如果只是一个次要的版本更改并且这些尚未签名,那么您可以只更换库。否则,您需要在app.config中添加绑定重定向以指向新版本的先前引用,或者只创建第二个项目文件,其中包含第二个文件夹中的更新引用。