Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I "Add Existing Item" an entire directory structure in Visual Studio?

I have a free standing set of files not affiliated with any C# project at all that reside in a complicated nested directory structure.

I want to add them in that format to a different directory in an ASP.NET web application I am working on; while retaining the same structure. So, I copied the folder into the target location of my project and I tried to “add existing item” only to lose the previous folder hierarchy.

Usually I have re-created the directories by hand, copied across on a one-to-one basis, and then added existing items. There are simply too many directories/items in this case.

So how do you add existing directories and files in Visual Studio 2008?

like image 557
Ian Patrick Hughes Avatar asked Sep 11 '08 22:09

Ian Patrick Hughes


People also ask

How do I add an existing directory to a solution in Visual Studio?

Right click the project or contained folder and choose Add | Existing Item... . Use Show All Files . Click on files or folders you would like to add to the project and choose Include In Project . Drag and drop files and folders from Windows Explorer.

How do I add an existing item in Visual Studio?

You can easily do this from Visual Studio by right clicking the project you want to include it in, and selecting Add > Existing Item… You're then presented with a file picker dialog, so you can navigate to the file, and choose Add.

How do I create a project from an existing source in Visual Studio?

Open your Visual Studio IDE. Navigate to the Visual Studio menu: File | New | Project From Existing Code... as shown in the below screenshot: This will open the Create New Project from Existing Code Files wizard dialog on the screen.


1 Answers

Drag the files / folders from Windows Explorer into the Solution Explorer. It will add them all. Note this doesn't work if Visual Studio is in Administrator Mode, because Windows Explorer is a User Mode process.

like image 117
Darren Kopp Avatar answered Nov 01 '22 09:11

Darren Kopp