How can I automatically add existing items to a Visual Studio project?

Viewed 22913

I have a tool which dynamically generates .xaml and .xaml.cs files and puts them in the appropriate Visual Studio directory.

To add them to the project, I have to then:

  • right-click on that directory
  • choose "add existing item"
  • navigate to the matching directory on the hard drive
  • select the two files that were created
  • click ok

Is there a way for me to tell the project to "include all existing items under the project folder on the hard drive"?

4 Answers

How to add files automatically into a Visual Studio project

Here’s a tip to automatically add all files that are in a particular folder into a Visual Studio (C++) project so that you won’t need to add files newly added in that folder into the project.

In the file .vcxproj, remove all CLCompile elements inside tag and add

<ClCompile Include="[Path to your source folder]\*.cpp" />

Do the same for header files. Now, your cpp and h files will be included automatically.

Related