简体   繁体   English

将参考 .net 核心库添加到 uwp 应用程序

[英]Add reference .net core library to uwp application

I'd like to create some new library for my applications with TargetFramework netcoreapp.我想使用 TargetFramework netcoreapp 为我的应用程序创建一些新库。

Is it possible to add this reference of .net core library to my UWP application?是否可以将 .net 核心库的参考添加到我的 UWP 应用程序中? When I tried to add this reference I got this error message:当我尝试添加此参考时,我收到此错误消息:

在此处输入图像描述

But I read that UWP application is part of .net core:但我读到 UWP 应用程序是 .net 核心的一部分: 在此处输入图像描述

I don't have problem to add .net standard library to my UWP app but I don't think it is correct solution for that because .net core is already multi platform and implemented UWP.我没有问题将.net标准库中的标准库中添加到我的ZADD4E130E8FD245A30CDED05570CZ应用程序中,但我认为它是Z2DD550972FCECD376129555509210955550951095555509FCECD129555509D109F10202020209F109FCECD1209D109D109D10D10D10D10D10D10D10D10D10D10D10D10D10D10D10D10D10DEDD10DEDD10DEDD.D10DEDND。 Or am I wrong?还是我错了?

When we create a cross-platform class library, we could use .NET Core or .NET Standard .当我们创建一个跨平台的 class 库时,我们可以使用.NET Core.NET Standard

.NET Core is about the application being able to run on multiple platforms. .NET Core 是关于能够在多个平台上运行的应用程序。 Currently,.NET Core only supports two project types, Console and ASP.NET Core.目前,.NET Core 仅支持两种项目类型,Console 和 ASP.NET Core。 Uwp is only for the Windows ecosystem, so you can't create a uwp app and expect it run on other OS than Windows. Uwp 仅适用于 Windows 生态系统,因此您不能创建 uwp 应用程序并期望它在 ZAEA23489CE3AA9B630ZECDABB 以外的其他操作系统上运行If you compile the class library to target .NET Core, it can be only used by a .NET Core application.如果将 class 库编译为目标 .NET 核心,则它只能由 .NET 核心应用程序使用。

.NET Standard is about sharing class library code between different .NET applications, such as WinForm, WPF, UWP,ASP.NET Core. .NET Standard is about sharing class library code between different .NET applications, such as WinForm, WPF, UWP,ASP.NET Core. Since they all have implemented some version of .NET Standard, which means that if the library is complied with a really low version(such as 1.0), the class library can be used by all.由于他们都实现了一些版本的 .NET 标准,这意味着如果该库符合非常低的版本(例如 1.0),则所有人都可以使用 class 库。

In a word, for your issue, it is recommended to reference .net Standard class library to uwp application.总之,对于您的问题,建议参考 .net标准 class 库到 uwp 应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM