Generated files and source control

Oct 15, 2012 at 4:50 AM

We're using Git (BitBucket) to manage the code for our ASP.NET MVC 3 Web Application.

At the moment, the *.generated.cs files are up on Git.

This is annoying because every commit of a View includes an updated *.generated.cs file.

If i exclude these files from source control, the next pull will not have these files, and the build will fail.

It appears the generated files are generated when you make a change to the View, whereas i would have thought it would make sense to do it as part of the build (Visual Studio).

Am i missing something - or how do people handle generated files and source control?

Oct 15, 2012 at 3:52 PM

You could consider using the msbuild package ( The files are generated during build but aren't checked in. 

Oct 16, 2012 at 12:52 AM

Thanks, but there seems to be an issue with the NuGet package, unless im doing something wrong.

When i install the package, it adds the package to the root packages.config (it should add to the project i installed it into), but it doesn't do anything else like add references to the DLL from the project, etc.

And there doesn't seem to be any documentation, so i have no idea how to use this package...