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

Ian Patrick Hughes picture Ian Patrick Hughes · Sep 12, 2008 · Viewed 248.8k times · Source

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?

Answer

Darren Kopp picture Darren Kopp · Sep 12, 2008

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.