在MVC 3,Visual Studio 2010中不能使用PagedList.Mvc [英] Can't use PagedList.Mvc in MVC 3, Visual Studio 2010

查看:243
本文介绍了在MVC 3,Visual Studio 2010中不能使用PagedList.Mvc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立使用Visual Studio 2010中我想分页数据的MVC 3网页,所以我用PagedList。它运作良好。现在,我需要创建页面之间的导航,我用PagedList.Mvc得到的HtmlHelper它。从的NuGet添加后,一切都很好,我建立它成功。当我运行,它显示了我一个编译错误与消息:

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:

编译器错误信息: CS1705:大会'PagedList.Mvc,版本= 4.0.0.0,文化=中性公钥= abbb863e9397c5e1'使用'System.Web.WebPages,版本= 2.0.0.0,文化=中性公钥= 31bf3856ad364e35'具有更高的版本比引用的程序集System.Web.WebPages,版本= 1.0.0.0,文化=中性公钥= 31bf3856ad364e35'

我应该怎么办?我如何使用PagedList.Mvc?感谢您的帮助。

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

推荐答案

看来你安装的NuGet需要剃刀2.0里面自带ASP.NET MVC 4.0。 ASP.NET MVC 3使用剃刀1.0。所以一定要安装一个版本的 PagedList.Mvc 的NuGet是与ASP.NET MVC 3.0兼容的。例如,你可以使用 3.18.0.0 版本,这是用剃刀1.0。

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.

要强制特定版本要安装一个给定的NuGet,而不是使用,你可以在你的NuGet控制台键入以下命令最新一期的:

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

这篇关于在MVC 3,Visual Studio 2010中不能使用PagedList.Mvc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆