I'm using T4 templates to automate creation of Poco objects. Ideally, these templates will run against multiple databases and will generate files going into separate folders based on where they came from. I already have the folder included in the project, is there anyway to add these generated files programmatically without knowing the names in advance?
Asked
Active
Viewed 1,348 times
2 Answers
2
After some more searching, I came across this answer which lead to me finding ProjectItems.AddFromDirectory
, MSDN source here, which solved my question!

Juan Abreut
- 41
- 1
- 6
-1
In Visual Studio, unload your project, then right click on it and edit the csprojfile.
You should be able to do something like this:
<ItemGroup>
<Compile Include="PlanExtract\*.cs" />
</ItemGroup>
Assuming that your generated files have a .cs extension.
Reload your project, then you should see the added files appear.

Richard Davis
- 199
- 4