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:UsersJonathanAppDataRoamingMicrosoftVisualStudio14.0ActivityLog.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?
See Question&Answers more detail:
os