by Andreas

Visual Studio 2010 – how to Add Existing Folder

Have you ever wanted to include an entire existing folder to your project, and not just files?

I used to do this the stupid way. Right click the project, choose Add New Folder, give it a reasonable name, open up the folder in Windows Explorer, copy my files into the folder, go back to Visual Studio, right click the folder, choose Add Existing Item and then finally include the files in the project. The stupid way.

imageYou can add an entire folders to your project directly, by first turning on “Show All Files” (tiny icon at the top of the Solution Navigator). Your folder will now be displayed as existing (e.g. my Scripts folder), but not part of your project. Right click the folder, choose “Include In Project” and not only will the folder and its containing files be added, but all subfolders as well. This was particularly neat in my case since the Scripts folder contained a jQuery component with corresponding library files stored in several sub folders.