将引用的 Dll 存储在 Visual Studio 解决方案文件夹中 [英] Storing referenced Dlls in visual studio solution folder

查看:25
本文介绍了将引用的 Dll 存储在 Visual Studio 解决方案文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个库文件夹来存储我所有的 dll.我目前正在做的建议是此处.有物理文件夹,创建解决方案文件夹,复制文件.

I want to have a library folder that stores all my dlls. What I'm currently doing is as suggested here. Have physical folder, create solution folder, copy the files.

如果我使用 SVN,我将不得不在文件资源管理器上使用 tortoise 来添加库.不确定我是否必须在 TFS 中做同样的事情.

If I'm using SVN, I'll have to use tortoise on the file explorer to add the library. Not sure if I'm going to have to do the same thing in TFS.

在 vs 2010 中,有没有更简单的方法来做到这一点?我希望能够将一个 dll 拖到 Visual Studio 内的库文件夹中,并让它物理地将 dll 放在文件夹中.

In vs 2010, is there any easier way to do this? I want to be able to just drag a dll into the library folder inside visual studio and have it physically put the dll in the folder.

推荐答案

我就是这样做的.不知道有没有其他更好的方法:

This is how I do it. Not sure if there is any other better way:

  1. 在解决方案资源管理器中右键单击您的解决方案.悬停添加"并选择新建解决方案文件夹".这不是一个真正的文件夹并且不指向任何物理文件夹.这是一个抽象构造用于在解决方案中对项目进行分组,但我们将使用它为别的.
  2. 称之为引用程序集"之类的东西.
  3. 接下来,再次右键单击您的解决方案,然后单击打开文件夹在 Windows 资源管理器中".在弹出的 Windows 资源管理器窗口中添加一个新的物理文件夹"(这将位于正下方解决方案的根文件夹).
  4. 您可以将其称为引用程序集",以便解决方案文件夹和物理文件夹共享相同的名称,以避免混淆.
  5. 抓住所有潜伏在任何地方的 DLL(即AjaxControlToolkit.dll 或埋在其中的 DocumentFormat.OpenXml.dll程序文件)和复制(不要拖拽 - 将原件保留在它们的位置)是)将它们放入 Windows 资源管理器中的引用程序集"文件夹中(不在解决方案中).
  6. 现在您可以从引用程序集"中拖动那些复制的 dll将 Windows 资源管理器中的物理文件夹放入引用程序集"解决方案文件夹中在 Visual Studio 的解决方案资源管理器中.
  7. 检查解决方案中的每个项目并删除所有引用到您将从引用的程序集"文件夹.
  8. 重新添加引用,但这次(在项目下)右键单击引用",单击添加引用...",选择浏览"选项卡,单击带有绿色箭头的文件夹图标(表示向上将鼠标悬停在一层"上),双击参考程序集"文件夹,选择您想要引用的所有 dll 并点击确定".
  1. Right-click on your solution from the Solution Explorer. Hover over "Add" and select "New Solution Folder". It's not really a folder and does not point to any Physical Folder. It's an abstract construct for grouping projects within a solution, but we'll use it for something else.
  2. Call it something like "Referenced Assemblies".
  3. Next, Right-click on your solution again and click on "Open Folder in Windows Explorer". In the windows explorer window that pops up add a new "Physical Folder" (this will be located right underneath the Solution's root folder).
  4. You can call it "Referenced Assemblies" so that the Solution Folder and Physical Folder share the same name so as to avoid confusion.
  5. Grab all those DLL's lurking everywhere (i.e. the AjaxControlToolkit.dll or the DocumentFormat.OpenXml.dll buried in program files) and copy (DO NOT DRAG - keep the originals where they are) them into the "Referenced Assemblies" folder in Windows Explorer (NOT IN THE SOLUTION).
  6. Now you can drag those copied dll's from the "Referenced Assemblies" Physical Folder in Windows Explorer into the "Referenced Assemblies" Solution Folder in Visual Studio's Solution Explorer.
  7. Go through each project in your solution and remove all references to the assemblies you will be referencing from the "Referenced Assemblies" folder.
  8. Add the references back in, but this time (under the project) right-click on "References", click "Add Reference...", select the "Browse" tab, click the folder icon with the green arrow (says "Up One Level" when hovering over it), double-click the "Reference Assemblies" folder, select all the dll's you wanna reference and click "OK".

你已经完成了.既然您的解决方案知道这些 dll 以及在哪里可以找到它们,那么当您检入代码(通过 SVN、TFS 或其他方式)时,它会将它们向上推送并复制下来供其他人使用.

You're done. Now that your solution knows of these dll's and where to find them, when you check in your code (via SVN, TFS, or whatever) it will push them up and copy them down for others to use.

如果您使用 TortiseSVN,如果您还使用 AnkhSVN 插件,则无需执行任何操作用于 Visual Studio.它研究您的解决方案文件(就像 TFS 一样)以查找解决方案引用的文件.在这种情况下,它将获取引用程序集"解决方案文件夹引用的新 dll 并在提交它们之前自动添加源代码控制跟踪(也就是说,如果您像我一样从 Visual Studio 中的解决方案资源管理器提交解决方案更改).

If your using TortiseSVN you don't have to do anything if you're also using the AnkhSVN plug-in for Visual Studio. It studies your solution file (just like TFS does) to find files referenced by the solution. In this case it will pick up on the new dll's being referenced by the "Referenced Assemblies" Solution Folder and automatically add source-control tracking before committing them (that is if you commit your solution changes from the Solution Explorer in Visual Studio like I do).

希望这会有所帮助.

这篇关于将引用的 Dll 存储在 Visual Studio 解决方案文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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