Reputation: 193282
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:
Is there a way for me to tell the project to "include all existing items under the project folder on the hard drive"?
Upvotes: 21
Views: 29454
Reputation: 47
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.
Upvotes: 0
Reputation: 18746
You can do this programatically in your .proj
file depending on your needs just like this answer
You just have to make sure you use the correct tag for the files.
Compile, Content, None, etc..
<ItemGroup>
<Content Include="Images\**\*.*" />
<Compile Include="Subdirectory\**\*.cs" />
</ItemGroup>
Upvotes: 42
Reputation: 8474
I do not have any automation for this. Still I follow following for the same requirement. This will avoid few clicking.
Upvotes: 20
Reputation: 34810
I don't think there is a way to do this natively in Visual Studio. Adding the files to the project modifies the project file.
This sounds like a good case for a simple addin. You can use the Visual Studio automation services to find the files you want added and add them all at once. You'd have complete control over the behavior of the addin, so you could reduce the process to a single click if practical.
Upvotes: -1