1

I have a Visual Studio Project that is using a MSBuild task to generate some code files. (The basis are xml files, and the generated code is quite lengthy, but noting special, just a lot of boilerplate.)

I’m not sure how I should handle the generated files:

  • Not include generated files in the project, and use MSBuild to make sure they get compiled (by adding respective <Compile...> tags to the <Target>).

  • Include generated files in the project, but exclude them from source control.

Any other options? Are there issues with these options? Experiences so far? Recommendations or best practices?

Martin
  • 466
  • 5
  • 12
  • Possible duplicate of [What Part of Your Project Should be in Source Code Control?](https://softwareengineering.stackexchange.com/questions/120477/what-part-of-your-project-should-be-in-source-code-control) – StayOnTarget Jul 06 '18 at 18:27

1 Answers1

2

Personally I include only the source files WRT source control. Its a rare case when generated files should be added to source control - maybe if they were generated once and never changed, and the generation step is lengthy or complex, otherwise I can't think of a good reason.

For compilation - if they need to be added to the project then I tend to add them - I prefer not to have hidden compilation files as part of the project as I prefer to know what its really building without any surprises. I do tend to put generated files in a filtered folder though so they are tucked away from daily view though.

gbjbaanb
  • 48,354
  • 6
  • 102
  • 172
  • I think that “not to have hidden compilation files as part of the project” is a good argument. – Martin Nov 17 '14 at 13:01