简体   繁体   English

自动完成功能在 Visual Studio Code 中的 ASP.NET Core 5 Razor Tag Helper 中不起作用

[英]Autocomplete not Working in ASP.NET Core 5 Razor Tag Helper in Visual Studio Code

I'm experiencing issues with Visual Studio Code autocomplete inside Razor Pages (.cshtml) with ASP.NET Core 5. The autocomplete works only for a few old projects.我在使用 ASP.NET Core 5 的 Razor 页面 (.cshtml) 中遇到 Visual Studio Code 自动完成问题。自动完成功能仅适用于一些旧项目。 For new ASP.NET Core 5 projects, it does not work.对于新的 ASP.NET Core 5 项目,它不起作用。 I already tried to restart OmniSharp, reinstall VS Code and extensions, but nothing solved the problem.我已经尝试重新启动 OmniSharp,重新安装 VS Code 和扩展,但没有解决问题。 I'm a programming teacher and my students are facing the same issue.我是一名编程老师,我的学生也面临同样的问题。 We are using the latest version of VS Code and .NET Core 5 stable release.我们正在使用最新版本的 VS Code 和 .NET Core 5 稳定版。 I appreciate any help.我很感激任何帮助。

Tag Helpers must be referenced somewhere, either directly in the file you are editing or in a _ViewImports.cshtml file. Tag Helpers 必须在某个地方直接引用,或者直接在您正在编辑的文件中或在 _ViewImports.cshtml 文件中。 Here is an example of referencing Microsoft's Tag Helpers.这是一个引用 Microsoft 的 Tag Helpers 的示例。

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

More info: https://docs.microsoft.com/en-us/aspnet/core/mvc/views/layout?view=aspnetcore-5.0#importing-shared-directives更多信息: https://docs.microsoft.com/en-us/aspnet/core/mvc/views/layout?view=aspnetcore-5.0#importing-shared-directives

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

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