简体   繁体   English

Asp.net 内核 razor 视图未格式化

[英]Asp.net core razor view is not formatted

The razor view formatting is so bad even when I tried ctrl k + ctrl d即使我尝试了 ctrl k + ctrl d,razor 视图格式也很糟糕

the page is so missed up该页面是如此错过

any help, please!任何帮助,请!

在此处输入图像描述

     @if (item.Details.Length > 10)
                        {
    @item.Details.ToString().Substring(0, 10) }
else
{
@item.Details}

You can enable the new Razor editor first, and then restart VS .您可以先启用新的 Razor 编辑器,然后重新启动 VS

Then you can choose Edit->Advanced->Format Document .然后你可以选择Edit->Advanced->Format Document

在此处输入图像描述

✎[Edit] ✎[编辑]

You can try the following methods:您可以尝试以下方法:

  1. Check whether three-party plug-ins are installed.检查是否安装了三方插件
    • If there are three-party plug-ins installed, temporarily disable them, and then test it.如果安装了三方插件,暂时禁用,再测试。
  2. You can try reset VS settings .您可以尝试重置 VS 设置
  3. Repair VS (repair in VS Installer )修复VS(在VS Installer中修复)
  4. Create a new project and check if the same problem occurs.创建一个新项目并检查是否出现相同的问题。
  5. Clean up the program /project/VS cache, then restart VS and try again.清理程序/project/VS缓存,然后重启VS再试。
    • The project is cached in the solution/project folder,you need to delete the bin, obj and.vs files .该项目缓存解决方案/项目文件夹中,您需要删除bin、obj和.vs文件
    • VS is cached in this path: C:\Users[user name]\AppData\Local\Microsoft\VisualStudio\16.0_XXXXXXXXX , delete all ComponentModelCache folder. VS缓存在这个路径: C:\Users[用户名]\AppData\Local\Microsoft\VisualStudio\16.0_XXXXXXXXX删除所有ComponentModelCache文件夹。
  6. Give feedback to the VS product group from VS-> Help-> Send Feedback-> Report a Problem...VS-> 帮助-> 发送反馈-> 报告问题VS 产品组提供反馈...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM