且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在标准.net控制台应用程序中使用.Net Core dll

更新时间:2022-05-23 22:03:26


如何解决这个?

How to resolve this?

您不能。至少不是直接。

You cannot. At least not directly.


  • .NET Core可以运行针对.NET Core本身或.NET Standard的程序集。

  • 。 NET Framework可以运行针对.NET Framework本身或.NET Standard的程序集。

因此,没有办法带来两个针对Full的程序集框架和核心分别在一起。不在Core中,也不在完整框架中。 (您也许可以找到黑客和但对我来说,这是可行的解决方案,但是对于特定的用例,它们是非常脆弱的例外。)

So there is no way to bring two assemblies that target Full Framework and Core respectively together. Not in Core and not in full framework. (You might be able to find hacks and "but for me this works" solutions all over the place, but they are super brittle exceptions for their specific use case).

您可以 将.NET Core程序集的目标框架切换到.NET Framework或.NET Standard,或者可以提供多个个目标框架来构建Nuget包支持.NET Core 完整框架。

You could switch your target framework of the .NET Core assembly to either .NET Framework, or to .NET Standard, or you could give multiple target frameworks to build a Nuget package that supports .NET Core and full framework.

但是如果您需要.NET Core程序集 .NET Framework应用程序,则不能以这种方式一起使用它们。

But if you need a .NET Core assembly and a .NET Framework application, you cannot use them together that way.