Today we were rebuilding an old project which used MVC 2.  There were a bunch of build errors, which I quickly figured was because of the reference to Microsoft.Web.MVC assembly which was a part of the Futures Preview for MVC 2 before MVC 3 came.

I removed the reference and secondly, I installed MVC 3 on the machine.  After that I removed all references to MVC 2 assemblies and added reference to the System.Web.Mvc dll version present in C:\Program Files(x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies.

With that, some of the errors went off.  But upon further building the project, I ran into quite a few issues with respect to Razor Views and existing MVC 2 codebase.

My colleague, as paranoid as always wanted to revert back to MVC 2 given that, there would be more work in changing all of them to suit MVC 3 assemblies and it wasn’t required at this time for a project which was working fine.  Typical customer style.

Then, I went ahead and removed the reference to MVC 3 and added back the MVC 2 assembly.

Bang came back the error on JsonValueProviderFactory references in Global.asax.  After scratching around for sometime, I figured that this assembly is now part of the System.Web.Mvc in MVC 3 whereas if we have to use it in MVC 2, we need to explicitly download and add the MVC 2 Futures Preview available at http://aspnet.codeplex.com/releases/view/41742 

Since the code was ported from another machine, this wasn’t copied and just MVC and required assemblies were installed.

I went ahead and installed the MVC 2 features which had the DLL Microsoft.Web.Mvc and after adding a reference to that DLL in the project and then putting up a using Microsoft.Web.Mvc, the error on line JsonValueProviderFactory vanished.

Please note, this is only required if you stick to use MVC 2 and with MVC 3 and above, this is not required.

Also, the MVC 2 futures was an experimental release, so I would assume it wouldn’t be supported and one has to use at one’s own risk.

Cheers !!!