.netcachingbuild

can I get .net compiler to do some optimistic caching to speed up the build without refactoring code base into assemblies?


my dotnet code base is pretty big (so I don't feel like undertaking refactor into assemblies project) but doesn't change all that much. The build is real slow, although disk speed is fine - apparently it just takes awhile to compile the thing. So IMHO it would have made good sense for the compiler to cache compiled versions of files that haven't changed since last build in the optimistic expectation that no change in another file broke the module. Then if the optimistic assumption proved invalid, the full build could be undertaken. Well, I am pretty sure that things like that are often done while using Java and C++ compilers.

Could something like that be done here in dotnet? If not, why not :-) ?


Solution

  • Visual Studio doesn't rebuild an assembly unless it has to. It "has to" when any of the following change:

    Also, build speed is less dependent on pure code count, or even class count, but the number of projects being built. Given a constant number of lines of code that must be fully rebuilt, a solution that builds into one assembly will build faster than a solution that builds into 10 assemblies, because there is a lot of overhead inherent in building an assembly that is repeated on each assembly.

    Here are some basic tips to increase build speed: