asp.net - 无法使用快速修复导入 namespace (Visual Studio Code)

标签 asp.net visual-studio asp.net-web-api visual-studio-code asp.net-core-2.0

大家好, 我的 Visual Studio 代码有问题。最初,当我安装扩展并使用 Visual Studio Code 时,如果我没有引用命名空间,名称下会出现一条红线,并且会有一个黄色灯泡(快速修复)建议我使用导入命名空间等等等等。但是,它不再这样做了。字段名称顶部曾经有引用数,例如,public int Id{get;set;} 顶部有 1 个引用等。我尝试再次安装扩展,但似乎没有解决问题。有人知道我如何解决这个问题吗?谢谢。

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;

namespace vega.Models
{
    public class Make
    {
        public int Id { get; set; } 

        [Required]
        [StringLength(255)]
        public string Name { get; set; }

        public ICollection<Model> Models { get; set; }

        public Make()
        {
            Models = new Collection<Model>();
        }
    }
}

最佳答案

CodeLens 似乎在 Visual Studio Code 中被禁用。

您可以通过“工具”下的“选项”菜单项在 Visual Studio 中启用它。 在“选项”屏幕中,转到“文本编辑器”-“所有语言”-“代码镜头”并在那里启用它。

关于asp.net - 无法使用快速修复导入 namespace (Visual Studio Code),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46255747/

相关文章:

mysql - 将 ASP.NET Core 身份从 SQL Server 迁移到 MySQL 时出现问题

asp.net - EntityFunction.TruncateTime 在我的查询中不起作用

c - 如何修复错误: incompatible types when returning type 'struct {aka struct <anonymous>}

asp.net - 编译错误CS0016 : Could not write to output file

asp.net - 如何停止 Web.Config 中 <configSections> 的继承

c++ - 如何修复静态库?

c# - 从外部运行 Visual Studio 测试项目

c# - 如何对 ASP.NET Web API 路由进行单元测试?

asp.net - 无法加载文件或程序集 System.Web.Http,版本=5.2.2.0

asp.net - 如何使用 Angular 调用 Asp.Net Web API 2.0 http 批处理请求?