How to add an existing folder to a Visual Studio project? - visual-studio

I have a web application project made in Visual Studio 2008.
Well, I added a jquery folder and added it to source control and other such things. I forgot to add it to the visual studio project though. How do I add the existing folder now? I've tried just creating a new folder and naming it jquery but it gave me a cryptic error "the directory is already on the disk ... if you want to see this directory then check the Show All Files option in the project file" Yet I looked and saw no such option.
Is the only way around this to rename jquery to jquery2 and then create a new folder via visual studio named jquery and copy all my files into it?

With your project open in Visual Studio, click on your project. Then go to the "Project" menu and select "Show All Files". You should now see any directories or file that are in the directory of the project but not included in the project.
Then, right-click on the folder you want to add, and select "Include in Project" from the context menu.

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

Where are new folders in Visual Studio 2015?

In VS2015 on Mac with an ASP.NET CORE project, when I try to create a new folder by right clicking the project in the solution explorer > Add > Folder. But it says it already exist:
File or directory name is already in use. Please choose a different
one.
I go into finder and see the folder is there. Why doesn't it display in VS2015?

Add reference during project load within Visual Studio

There some assemblies (.dll) or cs files in a folder named D:\MyFolder. I have project in Visual Studio and I want to add assemblies from above folder into References and add CS files from above folder on project load. Is there such feature?
Thanks.
There maybe slight differences depending on the version of Visual Studio that you are using but to add any dll as a reference to your project, just right click the 'References' folder of your project and then click the 'Browse' button in the Add References dialog.
This is the exact same procedure for adding a cs file to your project. Right click your project, click Add, click Existing Item and then find your cs file from the file dialog and press OK.
UPDATE: There is no automatic way to point to a folder and have all files and or references in that folder added. You can do a multi select of dll's or cs files in either dialog so that way you can multiple files.

How do I add a folder, not a "filter", in Visual Studio 2013?

I have a Visual Studio 2013 project within a folder called 'Source', let's say. I'd like to have some additional folders within that folder and I'm trying to find a way to do that. If I, in visual studio, create a new 'filter' (which looks like a folder) and create a file within it. It might appear to be within a new folder (as displayed by Visual Studio), but it actually is in the default Source folder.
I try a second approach and create the folder with the help of the operating system. I even create a file within it manually. Then I go to visual studio and add an existing item, selecting the file WITHIN the folder. Visual studio then adds the file, which is good, but its displayed as being in the default directory.
I suppose there is a very manual way. And thats mirroring everything. Creating a folder using the operating system. Creating a filter within visual studio, etc. And mirroring everything manually.
Is there a different way or do I create a better IDE in 2 days?
Simple Drag and Drop should work.
Keep your directory with source inside your project directory.
Drag and Drop directory structure from windows explorer to visual studio existing project.
Click "Show All Files" option in the top of Solution Explorer toolbox
After doing this you need to add this directories in your project.
Select that directory, right click and select "Include in project"
You are good to go!
Details here

How To ReInclude Excluded Folder

So I just performed the coup de gras on my project by accidentally clicking on Exclude From Project instead of Add on my controllers folder.
When trying to add a folder named Controllers I get the error "this folder exists". However, If I try to click on the project -> Add Existing... I cannot select a folder, but only the controllers.
Kind of at a loss here, has anyone had experience with this, or does anyone know how to get the folders back into the solution?
Click on the Show All Files icon in the solution explorer and then simply include the folder:
Visual Studio Express 2012
Select Your Project Folder Click On "Show All Files" icon to show all Excluded Folders And Files
Then Right Click on Excluded Folder or File and Click on "Include In Project"
In my ASP.Net Webforms project after excluding the file I could't find it even under 'Show all files', but they were at project folder so I had to right click on project in Visula Studio then add existing item.
For anyone wanting a different solution, you can also browse to your project in a File Explorer and delete the offending folder (Be sure to copy it somewhere safe first!). Restart Visual Studio and proceed to add the folder as you regularly would.

Resources