在Visual Studio解决方案中的多个项目中引用外部库的最佳方法

在Visual Studio解决方案中的多个项目中引用外部库的最佳方法

问题描述:

我们在VSS源代码管理下有一个Visual Studio 2008解决方案.该解决方案包含许多类库,其中许多类都需要引用不是该解决方案一部分的程序集.当前,我们在每个项目中保留该程序集的单独副本,但是随着项目数量的增加,将更新复制到外部程序集变得越来越繁琐.是否有更好的方法可以在解决方案和源代码管理中拥有程序集的单个副本,然后可以在所有项目中引用该副本?

We have a Visual Studio 2008 solution under VSS source control. The solution contains many class libraries, many of which need a reference to an assembly that is not part of the solution. Currently we are keeping separate copies of that assembly in each project but as the number of projects grows it gets increasingly tedious to copy in updates to the external assembly. Is there a better way to have a single copy of the assembly in the solution, and in source control, that can then be referenced in all the projects?

在根文件夹中创建一个外部库"/"lib"/库"文件夹,并将其添加到源代码管理中,并从那里引用项目中的参考库.使用参考属性中的复制本地",项目将自动将其复制到它的bin文件夹中.

Create an "external libraries"/"lib"/"libraries" folder in root folder, add it to source control and reference libraries in projects from there. With "Copy local" in reference properties project will automatically copy it to it's bin folder.

我们的项目结构:

workspace
  config
    partial app configs goes here
  lib
    external libraries goes here
  src
    Domain          
      domainProjects
    Infrastructure
      infrastructureProjects
        references 3rd party dll's from lib folder
    UI
    Tests        
  solutions
    primaryUIapplication
      references projects from "src" folder
    domainLogic
    etc.

在解决方案中,它看起来像:

In solution it looks like:

_misc
  config
  tests
Domain
Infrastructure
UI