Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limited Intelliesense in VS2013 on MVC3 project

I recently installed vs 2013 professional and opened one of my side project applications in it . The project is an MVC3 application using the razor view engine. I noticed that when editing a view (cshtml ) I wasn't getting access to intellisense that I was used to in 2012. 2 Examples i noticed right away were @Url.Content() and @Viewbag. The code still compiles and runs, just no intellisense. After messing with it a bit i figured i should check the upgrade log and sure enough i found ...

"Intellisense for Razor (CSHTML and VBHTML) files is limited to HTML markup. Please see http://go.microsoft.com/fwlink/?LinkID=317645 for additional information on how to upgrade an MVC 3 project."

The link provided just tells you to upgrade from mvc3 to mvc4. My question is: is that my only option ? In order to use VS2013 on older mvc3 projects am I going to have to upgrade them all or will vs2013 ever support full intellisense on mvc razor files?

like image 322
ajzeffer Avatar asked Oct 24 '13 13:10

ajzeffer


3 Answers

Found this here ...

Soon you will see a new version of MVC5 in VS2013. MVC5 will be incorporated in VS2013. MVC3 will not be supported in VS2013. I confirmed it on channel9 last time. So People who have installed only VS2013 or doesn’t have old version will be got trouble with the project that is still in MVC3. This error happen because MVC4 and 5 installation doesn’t contain the DLL that is used in Version 3 of ASP.NET MVC.

http://geekswithblogs.net/anirugu/archive/2013/10/16/how-to-migrate-asp.net-mvc-3--mvc4-project-to.aspx

Ended up upgrading the project to MVC 5 ... Created a new project and brought over all the contents of my model, view and controller folders. Also had to update the webconfig to include some packages I had installed in the previous project.

like image 117
ajzeffer Avatar answered Nov 15 '22 10:11

ajzeffer


Add these two lines inside each view:

@inherits System.Web.Mvc.WebViewPage<dynamic>
@using System.Web.Mvc.Html

and the intellisense will work again for MVC3 in VS2013

like image 22
SergeyT Avatar answered Nov 15 '22 10:11

SergeyT


You can try Unload the project from solution explorer and Reload it again. See if you can get your intellisense back. It worked for me.

like image 3
Xinan Avatar answered Nov 15 '22 10:11

Xinan