Should I store generated code in source control

code generationversion control

This is a debate I'm taking a part in. I would like to get more opinions and points of view.

We have some classes that are generated in build time to handle DB operations (in This specific case, with SubSonic, but I don't think it is very important for the question). The generation is set as a pre-build step in Visual Studio. So every time a developer (or the official build process) runs a build, these classes are generated, and then compiled into the project.

Now some people are claiming, that having these classes saved in source control could cause confusion, in case the code you get, doesn't match what would have been generated in your own environment.

I would like to have a way to trace back the history of the code, even if it is usually treated as a black box.

Any arguments or counter arguments?


UPDATE: I asked this question since I really believed there is one definitive answer. Looking at all the responses, I could say with high level of certainty, that there is no such answer. The decision should be made based on more than one parameter. Reading the answers below could provide a very good guideline to the types of questions you should be asking yourself when having to decide on this issue.

I won't select an accepted answer at this point for the reasons mentioned above.

Best Answer

Saving it in source control is more trouble than it's worth.

You have to do a commit every time you do a build for it to be any value.

Generally we leave generated code( idl, jaxb stuff, etc) outside source control where I work and it's never been a problem