简体   繁体   English

我可以在.net核心Web应用程序中使用任何旧的任意WIndows库吗?

[英]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: 遵循的步骤:

  1. Create a new .Net core web Application 创建一个新的.Net核心Web应用程序
  2. Added PetaPoco from NuGet (just an example) 从NuGet添加了PetaPoco(仅作为示例)
  3. Can't use the library 无法使用图书馆

在此处输入图片说明

在此处输入图片说明

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.

相关问题 我在Core 1.0 RC2(.NET Framework)Web App中使用哪种类库类型 - Which class library type do I use with a Core 1.0 RC2 (.NET Framework) Web App 将 Web 应用项目添加到我的解决方案中,并且解决方案中的其他项目已经使用 .net 框架,我可以将 .net 核心用于新项目吗? - adding a web app project to my solution, and the other projects in the solution already use .net framework, can I use .net core for the new project? 我可以在asp.net Web应用程序中使用opensocial.net库获取任何人的信息吗? - Can i use opensocial.net library in my asp.net web application to get information on any person? 我可以在wpf应用程序中使用网络核心库吗? - Can I use a net core library in a wpf application? 使用在 .Net Core 项目中使用旧样式“appSettings”的库 - Using a library that makes use of the old style "appSettings" in a .Net Core project 我可以在非 ASP.NET Core 的 .NET.core 应用程序中使用 HttpClientFactory 吗? - Can I use HttpClientFactory in a .NET.core app which is not ASP.NET Core? 是否可以从 a.Net Framework 应用程序使用 a.Net5(核心)库? - Is it possible to use a .Net5 (core) library from a .Net Framework app? 在a.Net Core Class库中使用Windows Forms - .NET核心控件库 - Use Windows Forms in a .Net Core Class Library - .NET Core Control Library Dockerize .NET CORE web 应用程序与依赖 class 库 - Dockerize .NET CORE web App with dependent class library 如何在.Net Framework 4.6.2应用程序中使用.Net核心类库(.NetStandard v1.5) - How can I use .Net Core Class Library (.NetStandard v1.5) into .Net Framework 4.6.2 Application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM