安装Web Essentials和Web编译器后,Razor编辑器格式化无法正常工作

ser*_*0ne 8 c# razor web-essentials visual-studio-2015 web-compiler

我刚刚用Visual Studio 2015重新安装了我的机器.我还安装了Web Essentials和Web编译器的扩展,但这些似乎导致了一个问题

例如,在安装Web Essentials和Web编译器之前,如果我正在编辑Razor视图,如果当前元素被格式化为几个标签,并且我按下回车键,则光标将自动标签到正确的位置.

工作实例:

<ul>
    <li> <!--press enter here-->
        |<!--would put cursor here-->
    </li>
</ul>
Run Code Online (Sandbox Code Playgroud)

非工作示例:

<ul>
    <li> <!--press enter here-->
|<!--put's cursor here-->
    </li>
</ul>
Run Code Online (Sandbox Code Playgroud)

这是因为我相信你能理解的很烦人!

我很确定它与Web Essentials或Web编译器有关,因为这不是一个问题.除此之外,我在启动时收到以下错误:

错误

这似乎是ActivityLog.xml的罪魁祸首

错误 编辑器或编辑器扩展

System.Reflection.TargetInvocationException:调用目标抛出了异常.---> System.ArgumentException:已添加项目.密钥字典:'RazorSupportedRuntimeVersion'密钥被添加:System.Collections.Hashtable.Insert(Object key,Object nvalue,Boolean add)中的System中的System.Collections.Hashtable.Add(Object key,Object value)中的'RazorSupportedRuntimeVersion'. Microsoft.VisualStudio.Html.Package.Razor.RazorVersionDetector.Microsoft.Html.Editor上的Microsoft.VisualStudio.Utilities.PropertyCollection.AddProperty(Object key,Object property)中的Collections.Specialized.HybridDictionary.Add(Object key,Object value). ContainedLanguage.Razor.Def.IRazorVersionDetector.GetVersion(ITextBuffer textBuffer)at Microsoft.Html.Editor.ContainedLanguage.Razor.RazorUtility.1.CreateTagger[T](ITextBuffer textBuffer) at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator1.GatherTaggers(ITextBuffer textBuffer)

kri*_*kri 2

今天发生在我身上,我按照此问题的已接受答案中的说明修复了问题:Visual Studio 2015 Broken Razor Intellisense

答案如下:

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

devenv.exe /resetuserdata
Run Code Online (Sandbox Code Playgroud)

并删除我的项目中的“.vs”文件夹。