[英]Can I use any old arbitrary WIndows library in a .net core web app?
I just can't understand why I can't use an old library in a .net Core app targeting Windows and the full .net framework (I don't care about multi-platform). 我只是不明白为什么我不能在针对Windows和整个.net框架的.net Core应用程序中使用旧库(我不在乎多平台)。
Just trying to understand the limits here. 只是想了解这里的限制。 I don't want to hit a wall after investing too much into it. 我不想在投入太多资金后碰壁。
Steps followed: 遵循的步骤:
From a comment from you on a deleted answer to this question 来自您对这个问题的删除答案的评论
It's not about this particular reference. 这与该特定参考无关。 I just want to understand why I can't use an arbitrary Windows DLL. 我只想了解为什么我不能使用任意Windows DLL。 (I don't care about multi-platform) – Eduardo Molteni (我不在乎多平台)– Eduardo Molteni
It appears you are not too concerned why this specific project is not working (the deleted answer you commented on covered that quite well and if it was not deleted I would have up-voted it) but why in general you can't use a .NET Framework DLL in a .NET Core project. 看来您不太担心为什么这个特定项目无法正常工作(您评论的已删除答案覆盖得很好,如果未删除,我会投票赞成),但总的来说您为什么不能使用。 .NET Core项目中的NET Framework DLL。
Here is a diagram showing the layout of the ".NET ecosystem" 这是一个显示“ .NET生态系统”布局的图。
Things built for .NET Framework can't use DLLs built specifically for .NET Core, and things built for .NET Core can't use DLLs built specifically for .NET Framework because they are two "siblings" in the hierarchy. 为.NET Framework构建的事物不能使用专门为.NET Core构建的DLL,而为.NET Core构建的事物不能使用专门为.NET Framework构建的DLL,因为它们是层次结构中的两个“同级兄弟”。
Both .NET Framework and .NET Core can use .NET Standard libraries in their projects because .NET Standard is the "parent" of both the framework and core. .NET Framework和.NET Core都可以在其项目中使用.NET Standard库,因为.NET Standard是框架和核心两者的“父级”。 Many newer NuGet packages now release versions that target .NET Standard so the library can be used with both versions. 现在,许多较新的NuGet软件包均发布了针对.NET Standard的版本,因此该库可同时用于这两个版本。 See the below chart to see what version of the .NET Standard library is compatible with various platforms. 请参阅下面的图表,以了解哪个版本的.NET Standard库与各种平台兼容。 netstandard libraries are forward compatible so something that is compatible with 1.5 (like .NET 4.6.2) is also compatible with versions 1.0-1.4 netstandard库是向前兼容的,因此与1.5兼容的东西(如.NET 4.6.2)也与1.0-1.4版本兼容
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.