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?
-
Possible duplicate of What Part of Your Project Should be in Source Code Control?StayOnTarget– StayOnTarget2018年07月06日 18:27:59 +00:00Commented Jul 6, 2018 at 18:27
1 Answer 1
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.
-
I think that "not to have hidden compilation files as part of the project" is a good argument.Martin– Martin2014年11月17日 13:01:37 +00:00Commented Nov 17, 2014 at 13:01
Explore related questions
See similar questions with these tags.