Method not found: ‘System.Collections.Generic.IDictionary`2 System.Web.Mvc.ModelBindingContext.get_ValueProvider()’

After upgrading an MVC v1.0 project to MVC v2.0 I started getting the following error:

 

 

Method Not found: MVC error

Method Not found: MVC error

 

Turns out this error is caused by the MVC Futures v1.0 Data Annotations library.

The Fix:

  • Remove the reference to System.ComponentModel.DataAnnotations
  • Remove the reference Microsoft.Web.Mvc.DataAnnotations, this is now included as part of MVC 2.0
  • Add a reference to c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.ComponentModel.DataAnnotations
  • Remove the line in Global.asax for setting the default ModelBinder to a new instance of Microsoft.Web.Mvc.DataAnnotations.DataAnnotationsModelBinder.