ASP.NET Core 引用外部程序包的时候,有时会出现下面的错误:

The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Sample.Infrastructure..NETStandard,Version=v1.6

ASP.NET Core: You must add a reference to assembly mscorlib, version=4.0.0.0

解决方式:添加"Microsoft.NETCore.Portable.Compatibility": "1.0.0"引用。

{
  "version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.6.0",
    "Microsoft.NETCore.Portable.Compatibility": "1.0.0"
  },

  "frameworks": {
    "netstandard1.6": {
      "imports": [ "dnxcore50", "net451", "portable-net45+win81" ]
    }
  }
}

参考资料:

相关文章:

  • 2022-03-02
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
猜你喜欢
  • 2022-12-23
  • 2021-11-13
  • 2021-07-17
  • 2022-12-23
  • 2022-03-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案