Visual Studio 2015 Broken Razor Intellisense [英] Visual Studio 2015 Broken Razor Intellisense

查看:27
本文介绍了Visual Studio 2015 Broken Razor Intellisense的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

After installing and then repairing my VS2015 instance I still cannot get intellisense (server side) to work in my MVC views. I get alerted by message prompt as soon as I open for the first time in a session an .cshtml file and get addressed to the Activitylog file. Error message retrieved in ActivityLog.xml (short version):

System.ArgumentException:已添加项目.键入字典:'RazorSupportedRuntimeVersion'

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

这是完整版:

System.Reflection.TargetInvocationException:已抛出异常通过调用的目标.---> System.ArgumentException:项目已经添加.字典中的关键字:'RazorSupportedRuntimeVersion' 键被添加:'RazorSupportedRuntimeVersion' 在System.Collections.Hashtable.Insert(Object key, Object nvalue, Booleanadd) at System.Collections.Hashtable.Add(Object key, Object value) atSystem.Collections.Specialized.HybridDictionary.Add(对象键,对象值)在Microsoft.VisualStudio.Utilities.PropertyCollection.AddProperty(Object键,对象属性)在Microsoft.VisualStudio.Html.Package.Razor.RazorVersionDetector.Microsoft.Html.Editor.ContainedLanguage.Razor.Def.IRazorVersionDetector.GetVersion(ITextBuffer文本缓冲区)在Microsoft.Html.Editor.ContainedLanguage.Razor.RazorUtility.TryGetRazorVersion(ITextBuffer文本缓冲区、版本&剃刀版)在Microsoft.Html.Editor.ContainedLanguage.Razor.RazorErrorTagger..ctor(ITextBuffertextBuffer) --- 内部异常堆栈跟踪结束 --- 在System.RuntimeMethodHandle.InvokeMethod(Object target, Object[]参数、签名 sig、布尔构造函数)在System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlagsinvokeAttr、Binder 绑定器、Object[] 参数、CultureInfo 文化)在 System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,活页夹活页夹,Object[] args,CultureInfo 文化,Object[]激活属性、StackCrawlMark&堆栈标记)在System.Activator.CreateInstance(类型类型,BindingFlags bindingAttr,活页夹活页夹,Object[] args,CultureInfo 文化,Object[]activationAttributes) 在 System.Activator.CreateInstance(Type type,对象[] args) 在Microsoft.Html.Editor.ContainedLanguage.Common.ContainedCodeErrorTaggerProvider'1.CreateTagger[T](ITextBuffer文本缓冲区)在Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator'1.GatherTaggers(ITextBuffer文本缓冲区)

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 扩展.

If it's any help, I have some font-coloring customizations, and have the Web Essentials, Bundler & Minifier and Web Compiler extensions installed.

更新:当我打开现有的 Web 应用程序或从头开始创建一个全新的应用程序时,会发生这种情况.还有一个 VS2013 实例安装并运行在同一台机器上.

UPDATE: it happens either when I open an existing web application or when I create a brand new one from scratch. There's also an instance of VS2013 installed and running on the same machine.

正如你从上面的图片中看到的,我完全没有智能感知,也没有任何类型的代码着色.

As you can see from the pic above I get no intellisense at all, nor any kind of code coloring.

任何有关如何修复它的线索?提前致谢.

Any clue about how to fix it? Thanks in advance.

推荐答案

我通过重置用户数据解决了这个问题

I solved this problem by resetting the user data

devenv.exe /resetuserdata

并删除我项目中的.vs"文件夹.

and remove the ".vs" folder in my project.

警告:这将重置您的所有用户设置.从本质上讲,这就像重置为出厂默认设置.您将丢失所有自定义键盘快捷键、已安装的扩展程序等.

WARNING: this will reset all your user settings. Essentially, it is like resetting to factory defaults. You will lose any custom keyboard shortcuts, extensions you've installed etc.

这篇关于Visual Studio 2015 Broken Razor Intellisense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆