Namespace not found in MVC 3 Razor view

后端 未结 9 1163
情话喂你
情话喂你 2021-01-04 20:29

I am adding a PagedList to my view and loosely following this Tutorial. I have installed the PagedList reference using Nuget, set up my controller as follows



        
相关标签:
9条回答
  • 2021-01-04 21:16

    Something is messed up with my overall project. I created a new project and copied the important items over and it all works now. I am not sure at all what is wrong with my original project.

    0 讨论(0)
  • 2021-01-04 21:24

    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

    0 讨论(0)
  • 2021-01-04 21:33

    I needed to add the namespace to the Views web.config file.

    Details are in this SO post:

    I then needed to close/re-open Visual Studio 2010 in order for it to recognize. Compiling the project didn't help (the web.config might only be read once upon project load).

    0 讨论(0)
提交回复
热议问题