开发者

Storing referenced Dlls in visual studio solution folder

开发者 https://www.devze.com 2023-02-10 12:36 出处:网络
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 fol开发者_JAVA百科der, copy the files.

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 fol开发者_JAVA百科der, copy the files.

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.

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. 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".

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.

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).

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号