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?
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.
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
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
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.
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