JsonValueProviderFactory in MVC 2

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 !!!

Print | posted on Saturday, April 21, 2012 9:57 PM

Comments on this post

# re: JsonValueProviderFactory in MVC 2

Requesting Gravatar...
Are you sure MVC 3 and above do not require this ?
Website design bangalore
Left by William on May 15, 2012 3:52 PM

# re: JsonValueProviderFactory in MVC 2

Requesting Gravatar...
Well not sure about the same, but thanks for sharing your thoughts.
Left by Frank on Jul 17, 2012 8:38 PM

# re: JsonValueProviderFactory in MVC 2

Requesting Gravatar...
It is so good! Thanks!
Left by cheapest cigarettes on Jul 26, 2012 12:59 AM

# re: JsonValueProviderFactory in MVC 2

Requesting Gravatar...
I wanted to thank you for this special read.I have also bookmarked you for checking out new posts.!!
Left by bangkok travel packages on Oct 16, 2012 9:19 AM

# re: JsonValueProviderFactory in MVC 2

Requesting Gravatar...
This worked well with my MVC 2 project. Thanks.
Left by Maria on Dec 01, 2012 5:37 PM

# re: JsonValueProviderFactory in MVC 2

Requesting Gravatar...
As far as I was recently told MVC 2 is based on ASP.NET, it allows software developers to build a Web application as a composition of three roles: Model, View and Controller.
Left by Debussy on Dec 03, 2012 2:24 AM

# re: JsonValueProviderFactory in MVC 2

Requesting Gravatar...
It would be fantastic if SQL Azure could know to partition data based on that.
Left by grama sintetica on Dec 20, 2012 7:23 PM

# re: JsonValueProviderFactory in MVC 2

Requesting Gravatar...
This worked great with my Json programming project. Thanks for that tipp...
Left by Annette on Feb 25, 2013 12:41 AM

# re: JsonValueProviderFactory in MVC 2

Requesting Gravatar...
Visit SQL Azure Registration at Microsoft Connect

Sign in with your Live ID (Passport, Hotmail, MSN, Live)
Left by oxyelite pro on May 04, 2013 2:30 AM

# re: JsonValueProviderFactory in MVC 2

Requesting Gravatar...
Sign in with your Live ID (Passport, Hotmail, MSN, Live)
Left by ganhar dinheiro na internet on May 09, 2013 5:06 AM

# re: JsonValueProviderFactory in MVC 2

Requesting Gravatar...
My colleague, as paranoid as always wanted to revert 640-554 examcollection 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 pass4sure 640-554 a project which was working fine. Typical customer style.



Left by roter on Oct 01, 2013 3:59 PM

Your comment:

 (will show your gravatar)