asp.net - Razor 语法高亮

标签 asp.net asp.net-mvc visual-studio razor visual-studio-2017

我有一个相当大的 ASP MVC 项目,我在 Visual Studio 15.4.5 中运行。每当我查看 .cshtml 文件时,Visual Studio 都会错误地突出显示该文件,例如:

enter image description here

  • 我们正在使用编译好的 razor View 。
  • 项目编译运行正常

  • 我试过的
  • 删除所有 bin、obj 和 .vs 文件夹
  • 正在运行 .\devenv.exe/ResetUserData
  • 正在运行 .\devenv.exe/UpdateConfiguration & .\devenv.exe/ClearCache
  • 最佳答案

    我在试图解决突出自己的麻烦时发现了这个问题,所以我想我会分享我的发现。显然,这是有意的行为,因为它被称为“Razor Syntax Highlighting”,通过 MSDN 上的 this post 和这里的另一个问题:How do you turn off Razor highlighting in VS 2013? 我能够确定如何在我的机器上关闭它。

    引自 MSDN 帖子:

    This highlighting is the built in support for Razor syntax highlighting. If you do not like it, you can open your .cshtml files in Visual Studio using the HTML editor



    对我有用的更改的屏幕截图:

    screenshot of options dialog

    关于asp.net - Razor 语法高亮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47657942/

    相关文章:

    c# - 获取 ASP.NET 开发服务器使用的所有端口的代码

    asp.net-mvc - NHibernate/MVC延迟加载因“session closed or no session”而失败

    css - 响应式网页设计和元素定位

    c# - .net 1.1 是否支持 64 位操作系统?

    c# - 错误 CS0234 命名空间 'Reporting' 中不存在类型或命名空间名称 'Microsoft'(您是否缺少程序集引用?)

    c# - 不支持区域性名称 'ha-latn'

    c# - Asp.Net Web API 中小数的自定义模型绑定(bind)器

    asp.net - "System.Net.HttpListener"在 IAppBuilder 属性中不可用

    javascript - 在 ajax 查询中加载图像 (ASP.NET)

    visual-studio - 检查是否在 Visual C# 中启用了调试