4

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?).

Tomek
  • 410
  • 3
  • 7
  • 16

6 Answers6

4

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

Community
  • 1
  • 1
3

Include

using PagedList;
using PagedList.Mvc;

in the pgm and run

Sachu
  • 7,555
  • 7
  • 55
  • 94
2

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.

luka032
  • 925
  • 4
  • 12
  • 34
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

annemartijn
  • 1,538
  • 1
  • 23
  • 45
  • well, It kind of works, but I still get an error in the toPagedList method. Reinsalling only adds PagedList.Mvc reference, not the PagedList. – Tomek May 17 '15 at 14:01
  • 1
    Actually I had to install two of those packages separately, thank you, Sir. – Tomek May 17 '15 at 14:04
0

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

live-love
  • 48,840
  • 22
  • 240
  • 204
0

I had the issue was because I was using another more than one web application and they did not use the same framework version :)

HAJJAJ
  • 3,667
  • 14
  • 42
  • 70