.NET Framework 4图书馆与.NET Core 2.2项目

huangapple go评论74阅读模式
英文:

.NET Framework 4 Library with .NET Core 2.2 Project

问题

我有一个现有的.NET Framework 4 DLL,我想要在一个新的.NET Core 2.2应用程序中引用它。这是可能的吗?

我已将该DLL添加为.NET Core项目中的一个程序集。它能够成功编译,但当我运行项目时,我收到以下错误信息:

"无法加载文件或程序集 'System.Data.Linq, Version=4.0.0.0...'。

不知道是否需要尝试将.NET Framework的DLL转换为.NET Standard?

英文:

So I have an existing .NET Framework 4 DLL that I would like to reference from a new .NET Core 2.2 application. Is this possible?

I have added the DLL as an assembly in the .NET Core project. It compiles fine, but when I run the project I'm getting this error:

> "Could not load file or assembly 'System.Data.Linq, Version=4.0.0.0...".

Wondering if I need to try to convert the .NET Framework DLL to .NET Standard?

答案1

得分: 2

想知道是否需要尝试将.NET Framework的DLL转换为.NET Standard?

这正是您想要做的。由于.NET proper和.NET core是"实现"框架,它们不能相互引用。但是,.NET Standard更像是一个"接口",因此可以从.NET proper和.NET core引用它。

.NET Standard的版本将取决于您所针对的框架版本。最低公共分母应该胜出。

请查看此文档

英文:

> Wondering if I need to try to convert the .NET Framework DLL to .NET Standard?

That is exactly what you want to do. Since .Net proper and .Net core are "implementation" frameworks they cannot reference each other. However, .Net standard is more of an "interface" so it can be referenced from both .Net proper and .Net core.

The version of .Net standard is going to depend on which framework version you are targeting. The lowest common denominator should win.

Have a look at this documentation.

答案2

得分: -1

我之前也遇到过类似的问题。因为要与Windows XP兼容,我不得不使用.NET 4.0。

.NET Core 2.2至少需要.NET 4.5。

解决方案是升级到.NET 4.5或更高版本,或者在.NET 4.0项目中保留.NET Core 2.2的概念。

英文:

I had similar problem some time ago. I had to use .NET 4.0 because of compatibility with Windows XP.

.NET Core 2.2 requires at least .NET 4.5.

Solution is to upgrade to .NET 4.5 or above or to leave concept with .NET Core 2.2 inside .NET 4.0 project

huangapple
  • 本文由 发表于 2020年1月7日 01:52:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/59616721.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定