c# - Visual Studio 2015 断 Razor Intellisense

标签 c# asp.net-mvc razor intellisense visual-studio-2015

安装并修复我的 VS2015 实例后,我仍然无法让智能感知(服务器端)在我的 MVC View 中工作。 当我在 session 中第一次打开 .cshtml 文件并找到 Activitylog 文件时,我会收到消息提示提醒。 在 ActivityLog.xml 中检索到的错误消息(简短版):

System.ArgumentException: Item has already been added. Key in dictionary: 'RazorSupportedRuntimeVersion'

完整版如下:

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)

如果有任何帮助,我有一些字体着色自定义,并安装了 Web Essentials、Bundler & Minifier 和 Web Compiler 扩展。

更新:当我打开一个现有的网络应用程序或当我从头开始创建一个全新的应用程序时,它就会发生。 还有一个 VS2013 实例安装并运行在同一台机器上。

No intellisense at all

正如您从上图中看到的,我根本没有智能感知,也没有任何类型的代码着色。

关于如何修复它的任何线索? 提前致谢。

最佳答案

这对我来说也经常发生,似乎与扩展更新有关,但我还不能归咎于任何具体问题。我能够发现的是一种侵入性较小的解决方案。

在我的例子中,删除这个目录的内容允许 IDE 恢复:

%LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache

编辑:我刚刚发现这个可能也很方便 - Clear MEF Component Cache (打开 VSIX 画廊)

关于c# - Visual Studio 2015 断 Razor Intellisense,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31581666/

相关文章:

c# - 使用 Kinect 和 Unity 与头像交互

asp.net - ASP.NET 中的请求和响应

css - 将 CSS 背景图像移动到 HTML 元素

javascript - 如何在 Razor MVC .net 中运行 javascript 函数

C# "Backward"将 Visual Studio 2010 .csproj 项目转换为 2008?

C# SslStream 读取问题

asp.net-mvc - 为什么.NET 在 MVC asp.net 应用程序中生成两个 web.config 文件?

c# - 如何将 HTML 字符插入到此 Html.ActionLink 中?

css - 如何使用 Asp.Net MVC Razor 语法通过循环连续显示 3 个元素

c# - 图像拖放(WPF 窗口)