Storing referenced Dlls in visual studio solution folder - visual-studio-2010

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.
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:
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.
Call it something like "Referenced Assemblies".
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).
You can call it "Referenced Assemblies" so that the Solution Folder and Physical Folder share the same name so as to avoid confusion.
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).
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.
Go through each project in your solution and remove all references
to the assemblies you will be referencing from the "Referenced
Assemblies" folder.
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.

Related

Visual Studio, Copy files to project directory problem

I have Visual Studio community 2017. coming from eclipse it was just enough to copy file to project directory and hit refresh then files were appearing in project explorer.
In VS, however when I copy some i.e. *.cpp or *.h in windows explorer to project directory, in VS solution explorer I can not see them. switching to folder view I see but can not include them into project.
via drag&drop to solution explorer (project view) I see them but are not part of project and in folder view and actual directory there is nothing.
what is going on with VS? How can I manually copy paste some files into project while they become part of project?
I will note that there's nothing "going on" with Visual Studio in the sense that something is actually wrong with it, it's just that adding files to your project just requires you to actually add them to your solution. Essentially, it allows you to add miscellaneous files to your folders without automatically including them in your build project (for example, if you're working with some test images/files).
To add files/folders to your project you simply right click on your project in the Solution Explorer and then go to Add > Existing Item.... Then, it's just a matter of selecting one (or Ctrl + A/Shift Clicking to select all/multiple files) and then it will add them to your solution.
In the solution explorer pane, click on the show all files button,
it will reveal all files including your pasted file,
Right click on your file and select "include in project".

How to add folders structure in VS2015?

In older versions of VS when you dragged a folder from windows file explorer into your VS solution, it would make a reference to that folder including all the sub folders' structure and files.
In VS2015 when I drag a folder into the solution it simpley makes a reference to all the files in that folder and sub folder but ignore the folder structure.
So it dumps all the files reference under one filter.
Is there a way to get the former behavior in VS2015?
The way that I do this is to add the folders to the project structure (i.e. underneath the .sln file) and then enable "Show All Files" (you may need a "Refresh").
Right click the folders you want to add and click "Include In Project".
(I didn't know about the drag and drop!)
The answer is as follows:
the reason you don't see the "include in project" is : either you created the solution externally to visual studio community or the solution got corrupt
to resolve this:
make a backup the solution (just in case)
in solution explorer - right click the project name , and choose "Rebuil solution"
Press the "show all files" (if not pressed already)
go to the folder you want to include, and now you should see the "include in project" option. Choose it
press again the "show all files" button (on top of the "solution explorer") to once again hide irrelevant files/folders from your solution explorer
Working with VS2015 and SSIS Solution:
Miscellaneous Folder - When I created a Sub-Folder in VS2015 and then Added the files contained therein it added them but not with the Name I Had but the name "Miscellaneous". Not how it worked in previous versions!
I was able to Add a Custom-Named Folder to the Solution but not the Project. When adding existing files to the Project it put them under the aforementioned Miscellaneous Folder.

Visual Studio Hide selected files

In the solution explorer I have a large number of .dlls that I would rather not have shown in the Solution Explorer - just to tidy up the display and allow me to focus on the files I need to.
Q) Is there a way to hide selected files from displaying in the Solution Explorer?
First delete the references of the dlls that you want to move.
Create a new folder in your project and put all those dlls into that new folder (from Windows explorer). Then by right clicking on them in VS, select Include In Project to be sure that they are included. (If they are included successfully, Exclude From Project should be written when you right click.)
Then if you add them as reference (by right clicking References>Add) again from that new folder, you should be able to use these dlls now without any problems.
Now you can minimize the new folder to tidy up the display.

VS 2010 .dll.refresh is in TFS but not .dll

I have a Web site project open from TFS. When I expand the files related to one dll, it shows that the .dll.refresh is under source control, but the plain .dll is not. If I right-click on the .dll there is no option to "Add to Source Control". How can I add it?
Thanks
Don't add the dll files from the bin folder. The .refresh files are text files which tell the aspnet compiler where to copy the dll files from. Open the .refresh files to see where it expects to find the dlls and manually add them from that location. Visual Studio will want to exclude them so using the Source Control Explorer window click the "add files" icon and in the dialog box that appears select the "excluded" page and include the dlls.
Make sure you add the dll folder(s) to the build workspaces if you're using builds.

adding multiple existing folders and multiple existing files to Visual Studio project in single step

Does anyone have a way to add multiple folders and (existing) files within those folders to a Visual Studio project in a single step (or via macro)? Let's assume all of the folders and files were copied/pasted into the project folder where they need to reside relative to the project folder, but are not actually stored in the .csproj or .vbproj file, which I believe is a requirement to compile those files into the solution/project.
This works great if you have a web application project in your solution, but not so well if you have a .csproj or .vbproj. In that case, you must manually add folders (and nested folders), and add existing files and browse to each one individually, which can take a long time.
In the solution explorer, select the project, click the "Show All Files" button - .
This will show all the files, even those not part of the project. You can now select all of these in the solution explorer (using Ctrl + Click) then right click and go to "Include In Project".
In Visual Studio 2013 (and possibly earlier) you drag the folder from windows explorer and drop it on the project in the solution explorer.
Other answer given in this thread wouldn't work for me as the files I want to add (DTSX files) are in a different folder, and copying/moving them causes other problems. Here is what worked for me:
Using Visual Studio 2015, use Windows Explorer to locate the files you want to add to your project. Copy those files to the clipboard. If DTSX files are what you are dealing with, in the Solution Explorer right-click on SSIS Packages, and then click on Paste.

Resources