Razor 智能感知在 VS 2015 中不起作用 [英] Razor intellisense not working in VS 2015

查看:18
本文介绍了Razor 智能感知在 VS 2015 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 2015 年加载我的 VS2013 项目时,我所有的剃刀视图都充满了红色波浪形下划线.

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 表达式

@model, @Scripts @url, @Html.Partial, lambda expressions

Intellisense 现在相当无用,因为它似乎缺少一半的选项.

Intellisense is now fairly useless as it seems to be missing half the options.

我看到的解决方案涉及删除 .vs 文件夹和 devenv.exe/ResetUserData,但是这些对我不起作用.

Solutions I've seen involved deleting .vs folder, and devenv.exe /ResetUserData, however these don't work for me.

我正在使用与我的同事相同的安装文件全新安装 VS 2015 社区.他们都没有剃刀问题,他们和我在做同样的项目.

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?

编辑...更多信息!我卸载/重新安装了 VS 2015 社区,打开了我的项目,然后剃刀工作了!然后我点击了一个通知,说更新 NuGet.安装 NuGet 更新,重新启动 VS,剃刀再次停止工作.所以 NuGet 更新正在打破剃刀??

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

每次打开 razor 文件时,它都会说遇到异常.这可能是由扩展引起的.您可以通过检查文件 'C:UsersJonathanAppDataRoamingMicrosoftVisualStudio14.0ActivityLog.xml'."

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?

推荐答案

您无需使用 devenv.exe/ResetUserData 重置 Visual Studio 的整个配置即可解决此问题

You dont need to reset the entire configurations of your Visual Studio using the devenv.exe /ResetUserData to workaround this

代替它,尝试在关闭 Visual Studio 的情况下删除此目录的内容,然后重新打开它:%LocalAppData%MicrosoftVisualStudio14.0ComponentModelCache

Instead of it, try to just delete the contents of this directory with Visual Studio closed then reopen it: %LocalAppData%MicrosoftVisualStudio14.0ComponentModelCache

这篇关于Razor 智能感知在 VS 2015 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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