X.PagedList.MVC namespace not available following NuGet install

2.5k Views Asked by At

I'm trying to switch from PagedList to X.PagedList. I've used NuGet to uninstall the PagedList and PagedList.Mvc packages and then to install X.PagedList and X.PagedList.Mvc.

When I go to update my views, I find myself in a strange situation: I can't seem to reference the PagedList.Mvc namespace as detailed in the example like this:

@using X.PagedList.Mvc;
@using X.PagedList;

In Visual Studio and when debugging, this gives the following exception:

The type or namespace name 'Mvc' does not exist in the namespace 'X.PagedList' (are you missing an assembly reference?)

(As an aside, if I leave off that using, I get exceptions about missing definitions, as expected.)

Is there a problem with the NuGet package? Is there some way to manually add an assembly reference to a package installed via NuGet?

1

There are 1 best solutions below

0
On BEST ANSWER

So, in the end I did find a hacky way to get this to work...

All I needed to do was manually add a reference to X.PagedList.Mvc.dll. Oddly, this was present in the packages directory (.\packages\X.PagedList.Mvc.5.3.0.5300\lib\net46) and has what looks to be a valid package file.

Not sure why this didn't happen automatically, but I'm suspicious that it was due to some conflict with the old PagedList.Mvc package.

Going to leave this question open for a week or two in case anyone can weigh in with something a little more insightful.


UPDATE: The approach above worked well locally, but failed when I deployed to test. This prompted a bit more digging and a resolution to get NuGet working properly.

I used the NuGet package explorer to find out that X.PagedList.Mvc targets a more recent version of the .NET framework than the project I was adding it to (4.6 vs 4.5). Bit disappointed that the install didn't fail more helpfully, but at least its sorted now.