VS2015 ASP.NET MVC the name 'model' does not exist in the current context

我怕爱的太早我们不能终老 提交于 2019-12-22 02:34:21

问题


I was working on an ASP.NET MVC 4 in VS2013 and everything was fine, then I've uninstalled 2013 and installed 2015, I was able to open the project, build it and even run, everything works fine (run/debug). The problem is that all my views are covered in errors:

the name 'model\Scripts\Url...' does not exist in the current context  

In addition, the .Where method of a list in the model shows an error as well as all the @Html helpers. I want to emphasize that the project still works w\o any problems so the issue is UI or package related. I tried to force uninstall\upgrade Microsoft.AspNet.MVC but the package manager console throws an error and rolls back the attempt. I can provide any necessary info if it helps, thank you in advance.


回答1:


The newly released VS2015 IDE seems to no longer support MVC3/MVC4 projects, while it only supports the MVC5:

Unable to find MVC3 , MVC4, MVC5 projects (or) No information about supported MVC Framework versions

If there are strict requirements to convert any existing MVC3/4 solution to MVC5 (for VS 2015), you can proceed with the steps listed in the How to Upgrade an ASP.NET MVC 4 and Web API Project to ASP.NET MVC 5 and Web API 2 guide.

Update 2016-05-03

It seems that after installing the VS 2015 SP2 update, it behaves much better. If you have a chance, I suggest that you upgrade your IDE and check if the issue goes away.



来源:https://stackoverflow.com/questions/32056601/vs2015-asp-net-mvc-the-name-model-does-not-exist-in-the-current-context

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!