Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Visual Studio: Add All Files in Directory to Project

📅 2012-Mar-01 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Problem

You need to add a directory full of source files into a Visual Studio project. But, this directory contains a big hierarchy of subdirectories with many source files at each level. It is too painful to manually add the files in each subdirectory by choosing the Add → Existing Item option.

Solution

 

  1. Place the directory of source files inside the directory of the Visual Studio project.

  2. Click the Show All Files icon (see above) at the top of Solution Explorer. Now, all the files in the directory of this project are displayed.

  3. Select all the displayed files or a specific directory, right-click and choose Include in Project. All of these files will be added to the project in a snap!

Tried with: Visual Studio 2010 and Visual C++ 2010 Express