Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No Intellisense in views updating from ASP.NET MVC 4 to MVC 5

I just updated an mvc4 project (using vs2012) to mvc5. After having a lot of issues related to dependencies, I finally found this tutorial and straightened things up so that it builds without issues However, I have to intellisense for any of the views (.cshtml files): @using, @model, @html.*, @styles... nothing works. I must have broken the reference to the razor view engine not being able to parse them properly. I have double checked the web.configs and cannot see anything. Any ideas? Thanks.

like image 742
user906573 Avatar asked Oct 21 '13 16:10

user906573


People also ask

What is MVC 5 controller with read write actions?

It is used to handle the user request coming from the browser. It will check the request from the browser and identify the action method and return the respective view. A controller is inherited from “ControllerBase” class which is inside the “System. Web.

What is mvc6?

MVC 6 is a part of ASP.NET 5 that has been designed for cloud-optimized applications. The runtime automatically picks the correct version of the library when our MVC application is deployed to the cloud. The Core CLR is also supposed to be tuned with a high resource-efficient optimization.


2 Answers

Went through the same agony, and was working without intellisense in views for about 3 weeks. Then I finally found it. It started working when I switched webpages setting to version 3 in web.config.

So in my web.config this was version 2.0.0.0, after i updated to 3.0.0.0 it started to work

  <appSettings>     <add key="webpages:Version" value="3.0.0.0"/>      ... </appSettings> 

Hopfully this was your issue to and will help becouse I feel your pain :)

--------------------------------------------------------

UPDATE: For others who are still looking for a fix for this issues in a post-MVC5 update, this helped me: In the ~/Views/web.config, updating from MVC 5.2.2.0 to 5.2.3.0 using Nuget did not update this line:

<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 

Updating 5.2.2.0 to 5.2.3.0 brought Intellisense back to life. You may have to close the view and re-open it to get the Intellisense to load.

like image 116
Dennis Puzak Avatar answered Oct 19 '22 23:10

Dennis Puzak


ASP.NET and Web Tools 2013.1 for Visual Studio 2012 has now been released and should resolved the MVC5 intellisense issue with VS 2012.

This release brings a ton of great improvements, and include some fantastic enhancements to ASP.NET MVC 5, Web API 2, Scaffolding and Entity Framework to users of Visual Studio 2012 and Visual Studio 2012 Express for Web.

You can download the update: http://blogs.msdn.com/b/webdev/archive/2013/11/18/announcing-release-of-asp-net-and-web-tools-2013-1-for-visual-studio-2012.aspx

like image 24
hatsrumandcode Avatar answered Oct 20 '22 00:10

hatsrumandcode