Asp – How to setup ASP.Net MVC solution for quickest build time

asp.net-mvctdd

I want to find the best setup for ASP.Net MVC projects to get the quickest code-build-run process in Visual Studio.

How can you set up your solution to achieve near zero second build times for small incremental changes?

If you have a test project, with dependencies on other projects in your solution, a build of the test project will still process the other projects even if they have not changed.
I'm don't think it is entirely rebuilding these projects but it is certainly processing them. When doing TDD you want an near zero second build time for your small incremental changes, not a 20 – 30 second delay.

Currently my approach is to reference the dll of a dependent project instead of referencing the project itself, but this has the side effect of requiring me to build these projects independently should I need to make a change there, then build my test project.

One small tip, if you use PostSharp, you can add the Conditional Compilation symbol SKIPPOSTSHARP to avoid rebuilding the aspects in your projects during unit testing. This works best if you create a separate build configuration for unit testing.

Best Answer

I like Onion architecture.

Solution should have ~3 projects only =>

  • Core
  • Infrastructure
  • UI

Put 2 more projects (or 1 and use something like nUnit categories to separate tests) =>

  • UnitTests
  • IntegrationTests

It's hard to trim down more. <= 5 projects aren't bad. And yeah - avoid project references.

Unloading unnecessary projects through VS might help too.

And most importantly - make sure your pc is not clogged up. :)


Anyway - that's just another trade off. In contrast to strongly typed languages - dynamic languages are more dependent on tests but it's faster and easier to write them.


Small tip - instead of rebuilding whole solution, rebuild selection only (Tools=>Options=>Keyboard=>Build.RebuildSelection). Map it to ctrl+shift+b. Original map remap to ctrl+shift+alt+b.