无法添加项目.net core 2参考但可以添加dll .net core 2参考

时间:2022-11-13 07:33:33

i don't know why, i can't add a project library in .Net core 2.0 reference to my universal windows plateform application (target 10.0.16299) .

我不知道为什么,我不能在.Net core 2.0中添加一个项目库参考我的通用windows平台应用程序(目标10.0.16299)。

i get this error:

我收到此错误:

unable to add a reference to project '[projectName]'

But if i choose to add directly the dll from the project library .Net core 2.0. Everything work well.

但是如果我选择直接从项目库.Net core 2.0中添加dll。一切都运作良好。

So why i can add a dll but not the project reference ? If someone have some idea, i will appreciate it, thanks in advance

那么为什么我可以添加一个DLL而不是项目参考?如果有人有一些想法,我会很感激,谢谢你提前

1 个解决方案

#1


3  

From a target framework compatibility point of view, an UWP project cannot reference a .NET Core 2.0 project since they are incompatible. It may technically work using the dll directly, since the implementations share similarities, but there may be difficulties. The project reference executes a sanity check which fails as expected. When you reference a DLL directly, you are responsible for making sure that it was built for a compatible framework.

从目标框架兼容性的角度来看,UWP项目不能引用.NET Core 2.0项目,因为它们不兼容。它可能在技术上直接使用dll工作,因为实现具有相似性,但可能存在困难。项目引用执行完整性检查,该检查按预期失败。直接引用DLL时,您有责任确保它是为兼容框架构建的。

To share code between a .NET Core 2.0 app and a recent version of UWP, you need to create a .NET Standard project, since both UWP and .NET Core support .NET Standard.

要在.NET Core 2.0应用程序和最新版本的UWP之间共享代码,您需要创建一个.NET Standard项目,因为UWP和.NET Core都支持.NET Standard。

#1


3  

From a target framework compatibility point of view, an UWP project cannot reference a .NET Core 2.0 project since they are incompatible. It may technically work using the dll directly, since the implementations share similarities, but there may be difficulties. The project reference executes a sanity check which fails as expected. When you reference a DLL directly, you are responsible for making sure that it was built for a compatible framework.

从目标框架兼容性的角度来看,UWP项目不能引用.NET Core 2.0项目,因为它们不兼容。它可能在技术上直接使用dll工作,因为实现具有相似性,但可能存在困难。项目引用执行完整性检查,该检查按预期失败。直接引用DLL时,您有责任确保它是为兼容框架构建的。

To share code between a .NET Core 2.0 app and a recent version of UWP, you need to create a .NET Standard project, since both UWP and .NET Core support .NET Standard.

要在.NET Core 2.0应用程序和最新版本的UWP之间共享代码,您需要创建一个.NET Standard项目,因为UWP和.NET Core都支持.NET Standard。