.net core Net核心2:无法从KeyNotFoundException继承

.net core Net核心2:无法从KeyNotFoundException继承,.net-core,nuget,.net Core,Nuget,我有点奇怪: 我上过这样的课: using System; using System.Collections.Generic; namespace My.Client { public class XNotFoundException : KeyNotFoundException { public XFoundException(string s, Exception e) : base(s, e) { } } } 该类

我有点奇怪:

我上过这样的课:

using System;
using System.Collections.Generic;
namespace My.Client
{
    public class XNotFoundException : KeyNotFoundException
    {
        public XFoundException(string s, Exception e) : base(s, e)
        {

        }
    }
}
该类通过nuget包发布,该包包含Refit 4.3.0和AspNetCore.2.0.6

引用此包的项目尝试使用该类。。但是构建找不到该类。这个包中的其他类可以正常工作。他们收到的错误是:

CS0246:未能找到类型或命名空间名称“XNotFoundException” 找到(是否缺少using指令或程序集引用?)


如果我从Exception而不是KeyNotFoundException继承,它将“工作”。但是为什么呢?是否有我遗漏的一些复杂问题?

您从生成系统中得到的确切错误是什么?@JohnKoerner错误是:错误CS0246:找不到类型或命名空间名称“XNotFoundException”(您是否缺少using指令或程序集引用?)nuget包的目标框架是.net core 2.0还是.net standard 2.0,还是其他什么?