Just a quick “gotcha” I ran into. For whatever reason, the standalone .NET 4.0 installation does not contain MVC bits. You only get them by installing Visual Studio 2010 itself. Why Microsoft continues to do this is beyond me (they also do it with certain web copy/publish MSBuild targets). I’m about to explode with nerd-rage at this nonsense, so I’ll quickly move on to the solution.
Since you aren’t likely to install Visual Studio on your webserver, the easy solution there is just to make the reference to System.Web.Mvc set to Copy Local. Easy enough work-around. On your build server however, that won’t do any good, because it’s not in source control. What you’ll have to do is either copy the DLL to your build server manually at the path referenced in your project, so your build server can find it, or copy it to your solution as an external reference, add it to source control, and reference it in your project from where you added it as an external reference in your solution. This is the option I took, that way we can have more build agents in the future without having to remember “oh yeah” for each machine.
Seriously, what the hell, Microsoft? Quit making shit look like it’s part of the f’in framework when it isn’t.