4
votes

I'm building a MVC 3 web using Visual Studio 2010. I want to paging data, so I use PagedList. It works well. Now, I need to create a navigation between pages, I use PagedList.Mvc to get HtmlHelper for it. After add it from Nuget, everything is fine, I build it successfully. When I run, it shows me an Compilation error with the message:

Compiler Error Message: CS1705: Assembly 'PagedList.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=abbb863e9397c5e1' uses 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

What should I do now? How can I use PagedList.Mvc? Thanks for your help.

1

1 Answers

9
votes

It seems that the NuGet you installed requires Razor 2.0 which comes with ASP.NET MVC 4.0. ASP.NET MVC 3 uses Razor 1.0. So make sure you install a version of the PagedList.Mvc NuGet that is compatible with ASP.NET MVC 3.0. For example you could use the 3.18.0.0 version which is compatible with Razor 1.0.

To force a specific version to be installed for a given Nuget instead of using the latest one you could type the following command in your NuGet console:

Install-Package PagedList.Mvc -Version 3.18.0.0