Visual Studio cannot resolve model, but Razor pages loads

后端 未结 4 1322
梦毁少年i
梦毁少年i 2020-12-10 13:02

I have an MVC 5 application, made from the empty template. I\'ve added Microsoft.AspNet.Mvc via Nuget and my packages file looks like so:

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-10 13:42

    I encountered this issue and tried every solution under the sun. For a week I tried editing the web config (in both the view and the root), reloading the project, clearing resharper caches.. you name it, I tried it. I loaded up an old project and hovered over the "Layout" and "Model" sections to see what namespaces they required. On closer examination, the namespaces which were required had been removed from my project. I have no idea how - I had recently performed an upgrade.. Anyhow - I referenced these 2 files from the solution folder System.Web.Mvc and another, rebuilt, and it worked. I could have danced on the spot. Hope this helps someone down the line!

提交回复
热议问题