When I load up my VS2013 projects in 2015, all my razor views are filled with red squiggly underlines.
@model, @Scripts @url, @Html.Partial, lambda expressions
Intellisense is now fairly useless as it seems to be missing half the options.
Solutions I've seen involved deleting .vs folder, and devenv.exe /ResetUserData, however these don't work for me.
I'm on a fresh install of VS 2015 Community using the same install files as my colleagues. None of them have the razor issues, and they're working on the same projects as I am.
Any idea how to fix this?
Edit...Further Info! I uninstalled/reinstalled VS 2015 Community, opened my projects, and the razor worked! I then clicked on a notification saying to update NuGet. NuGet update installed, VS restarted, razor stopped working again. So the NuGet update is breaking razor??
Every time I open a razor file it says "An exception has been encountered. This may be caused by an extension. You can get more information by examining the file 'C:\Users\Jonathan\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml'. "
In the activity log I get the following error
"System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Item has already been added. Key in dictionary: 'RazorSupportedRuntimeVersion' Key being added: 'RazorSupportedRuntimeVersion' at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) at System.Collections.Hashtable.Add(Object key, Object value) at System.Collections.Specialized.HybridDictionary.Add(Object key, Object value) at Microsoft.VisualStudio.Utilities.PropertyCollection.AddProperty(Object key, Object property) at Microsoft.VisualStudio.Html.Package.Razor.RazorVersionDetector.Microsoft.Html.Editor.ContainedLanguage.Razor.Def.IRazorVersionDetector.GetVersion(ITextBuffer textBuffer) at Microsoft.Html.Editor.ContainedLanguage.Razor.RazorUtility.TryGetRazorVersion(ITextBuffer textBuffer, Version& razorVersion) at Microsoft.Html.Editor.ContainedLanguage.Razor.RazorErrorTagger..ctor(ITextBuffer textBuffer) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at Microsoft.Html.Editor.ContainedLanguage.Common.ContainedCodeErrorTaggerProvider`1.CreateTagger[T](ITextBuffer textBuffer) at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.GatherTaggers(ITextBuffer textBuffer)"
How do I fix this?
You dont need to reset the entire configurations of your Visual Studio using the devenv.exe /ResetUserData
to workaround this
Instead of it, try to just delete the contents of this directory with Visual Studio closed then reopen it:
%LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache
Here's what FINALLY worked for me: Start -> Run -> (Or Windows Key + R) Then type "devenv.exe /resetuserdata" (no quotes of course)
I did not have to delete the .vs file, as some others had experienced.
See also: Visual Studio 2015 Broken Razor Intellisense
I've upgraded to mvc5 and so forth to razer 3. It solved my issue.
I followed this instructions :
http://www.asp.net/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-21
Had the same issue. ResetUserData didn't work, etc. What ResetUserData did do though was reset some of the dialogs that were suppressed. Ultimately a dialog popped up stating "The 'CompatiblityCheckerPackage' did not load correctly." It told me to go to my users folder (path below) and check out the ActivityLog.xml. Turns out WebEssentials 2015 did not install correctly and was failing to load. I installed WebEssentials again and the Intellisense errors went away.
Full Path for me:
C:\Users\xxx\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml
Hope this helps.
This could fix similar problems (I got it from somewhere, unfortunately I cannot remember, on Github)
> cd "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\Common7\IDE"
> devenv /updateconfiguration
> devenv /clearcache
I hope the above will be helpful to someone.C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE>
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE>devenv /updateco nfiguration
C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE>devenv /clearcac he
- Nadir
Deleting the entire Solution
and re-downloading it from Source Control
is the only thing that worked for me. You might need to open the solution in VS 2013 first before you can open it in 2015... a very buggy Visual Studio release Microsoft!
Edit: Another thing that is strange, at least for me... deleting the red zigzag underlined text then retyping it fixed the problem! Possibly just a random thing that happened to me.
I had same issue and none of these answers worked. What I finally saw was, my Views web.config file was referencing MVC 4, and my main web.config was referencing MVC 5. So I could compile fine but intellisense wasn't working. MVC 4 isn't supported in VS2015. Why my web.config files were different I don't know. When I updated MVC in VS2012 months ago it must not have updated that config file.
You don't to update anything.
Just delete component cache from this folder
C:\users\xxx\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache
And ot will work fine .
Try it
None of these solutions fixed it for me. What worked was ensuring my webpages version was up to date. So
<add key="webpages:Version" value="3.0.0.0" />
in the web.config, instead of version 2.0.0.0
And then closing and reopening visual studio with the same solution.
I am using VS 2015 professional. Faced the same issue, tried all mentioned above solutions and nothing worked. Neither "devenv.exe /ResetUserData" nor "deleting content of ComponentModelCache".
The only way I managed to solve the issue is by modifying the installation: Go to Program and Features -> Find Microsoft Visual Studio ... 2015 -> Click Change -> Select Modify -> Check "Microsoft Web Developer Tools" -> Click Update
That worked for me.
i have read a lot of solutions, a i have lose much time, and when i was sure to not resolve the problem of visual studio 2015 intellisense, eureka, some one was giving the right solution: lean & clear 2 lines of code those I run in cmd (like administrator):
whe restart visual studio maybe it ask to reinstall one tools that was broked. Well you do but still fron now your intellisense is going work agane. good luck at all and much thanks at Nadir
Just do one thing and go to:
Tools > Extension & Update > Update Your Visual Studio Version
It take some time but after that working fine.
I know that this topic is out of date, but I've just overcome the same problem and my resolution is not related to any one of the listed here.
The issue is that in my project properties the parameter "Output path" (Build->Output) was a folder different from just "bin\". After changing it to bin\, reopening the Studio and rebuilding my project, everything worked out!
Hopefully, it might help someone.
Just Put a Break point on the First line
of Page. and remove it after few seconds... it will definitely work...