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?
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With