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

查看:105
本文介绍了Razor intellisense在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 Community.他们都没有剃须刀的问题,他们正在从事与我相同的项目.

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

每次打开一个剃刀文件时,它都会显示遇到了异常.这可能是由扩展名引起的.您可以通过检查文件'C:\ Users \ Jonathan \ AppData \ Roaming \ Microsoft \获得更多信息. VisualStudio \ 14.0 \ ActivityLog.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:\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)"

我该如何解决?

推荐答案

您无需使用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%\Microsoft\VisualStudio\14.0\ComponentModelCache

Instead of it, try to just delete the contents of this directory with Visual Studio closed then reopen it: %LocalAppData%\Microsoft\VisualStudio\14.0\ComponentModelCache

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

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