views:

74

answers:

2

I'm using code generation and would like to automatically add the newly generated files into the project file after the generation is complete. If I add the files by modifying the project file, they don't get the plus icon next to them like when add them through the IDE. As a result, they don't get added to source control when I check the files in.

Is there a way to programmatically add a file to a project file in a way that will make it have the plus icon next to it to add it to source control?

A: 

Use CMake instead of maintaining VStudio project/workspace/solution files. Track the CMakeLists.txt files, and then generate a valid build environment.

Terry Lorber
+1  A: 

The reason you are seeing this behavior is because the Visual Studio source control provider interface only gets invoked by adding the file via the solution explorer. Modifying the project file directly will not notify the source control provider that it needs to add a new file to source control. If you generate new files, then the routine that generates those files will also need to make the calls to the source control library (usually via a command line interface but it could have a .net api as well) to add the newly created file to source control.

Darren Stokes