Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 429
HardLuck Avatar asked Aug 17 '15 17:08

HardLuck


1 Answers

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.

like image 101
Mikhail Avatar answered Nov 14 '22 01:11

Mikhail