Visual studio MVC razor view intelisens and breakpoints not working

309 views Asked by At

I am using visual studio 2012 (Premium). I have a project that is using MVC. I am not able to add any breakpoint to the view(s) and thus unable to debug the variables at view side. Moreover, Intelisens is also not working at views.

What I have tried:

I tried resetting the user setting devenv.exe/resetusersetting. Tried clear the cache using below command: Hide Copy Code C:\Users\pgoel\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache

I also tried many other things I came cross while looking for the solution but nothing works. Please help me out to get it fixed.

1

There are 1 answers

0
Puneet Goel On

After spending a lot of time looking for solution, I come across that for MVC projects, the version of MVC I am using should be installed in the environment. Although if I have added the dll but not installed in environment, the project will work but intellisense won't work.

Here is the fix. Go to web.config.

<dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
      </dependentAssembly>

See the version of MVC you are using and run the following Nuget command to install it.

PM > Install-Package Microsoft.AspNet.Mvc -Version 5.2.3

Version should be the same as mentioned in you web.config or MVC dll you are using.

See link for more information