问题
I am following the MVC tutorial, I installed PagedList package, and I cannot use the PagedList reference in the controller.
The type or namespace name 'PagedList' could not be found (are you missing a using directive or an assembly reference?).
回答1:
Check your references to see if there is a reference to the PagedList assembly.
If there isn't: Try to reinstall the package
If there is a reference: Check if the file actually exists on the location specified.
Reference example http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-29-92/7750.v20SysRefProps.JPG
回答2:
First sorry for my terrible English. In my case, I use the MVC5 in Visual Studio Community 2015 and I solved the problem this way:
First I delete the cache of Visual Studio and NuGet cache:
- Visual studio - go to %LocalAppData% \Microsoft\WebsiteCache and delete all folder.
- Nuget - here
After I use the package manager console to remove PagedList.MVC, then remove PagedList and then re-install them again like so:
- uninstall-package PagedList.mvc
- uninstall-package PagedList
- install-package PagedList
- install-package PagedList.mvc
I holpe that help
回答3:
Include
using PagedList;
using PagedList.Mvc;
in the pgm and run
回答4:
PagedList and PagedList.Mvc are being installed separately.
NuGet console install commands:
Install-Package PagedList
Install-Package PagedList.Mvc
Make sure you've installed both of packages.
回答5:
I use DNN. My problem was the package (DotNetNuke.Core.8.0.1.239) was outdated.
Check in your solution folder if you have the package installed:
..MySolutionFolder\packages\DotNetNuke.Core.8.0.1.239 (your package name)
Right click on Solution, go to Manage Nuget Packages.
Click on Browse, search for DotnetNuke.
Install:
DotNetNuke.Core
DotNetNuke.Web
回答6:
I had the issue was because I was using another more than one web application and they did not use the same framework version :)
来源:https://stackoverflow.com/questions/30287449/pagedlist-package-installed-missing-assembly-reference-error-in-controller