Resharper使用语句标记红色在asp.net核心中使用类库

ari*_*its -1 c# class-library using reference asp.net-core

看附图

我创建类库,创建Web应用程序项目,然后添加引用类库的Web应用程序项目按此处的说明,而是"利用"它不能添加.(customer.cs的命名空间也是"CDemoLib")(当我添加"使用CDemoLib"时,我得到'无法解析符号CDemoLib'

customer.cs的代码是

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CDemoLib
{
 public class Customer
 {
    private int _age;
    private string _name;

    public Customer()
    {
        Age = 0;
        Name = "Not available";
    }

    public int Age
    {
        get { return _age; }
        set { _age = value; }
    }
    public string Name
    {
        get { return _name; }
        set { _name = value; }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

参考扩展

Tho*_*mar 5

好吧,using不会添加对程序集的引用,而是添加程序集中声明的名称空间.程序集中声明的名称空间可能与程序集文件名非常不同.

双击解决方案资源管理器中的引用(屏幕截图中的右箭头)以打开"对象目录".您将能够在那里看到名称空间.