adding multiple existing folders and multiple existing files to Visual Studio project in single step

MacGyver picture MacGyver · Sep 15, 2011 · Viewed 13k times · Source

Does anyone have a way to add multiple folders and (existing) files within those folders to a Visual Studio project in a single step (or via macro)? Let's assume all of the folders and files were copied/pasted into the project folder where they need to reside relative to the project folder, but are not actually stored in the .csproj or .vbproj file, which I believe is a requirement to compile those files into the solution/project.

This works great if you have a web application project in your solution, but not so well if you have a .csproj or .vbproj. In that case, you must manually add folders (and nested folders), and add existing files and browse to each one individually, which can take a long time.

Answer

Oded picture Oded · Sep 15, 2011

In the solution explorer, select the project, click the "Show All Files" button - enter image description here.

This will show all the files, even those not part of the project. You can now select all of these in the solution explorer (using Ctrl + Click) then right click and go to "Include In Project".