如何从 .NET Framework 构建的项目引用在 .NET Core 中构建的项目? [英] How to reference a project built in .NET Core from one built from .NET Framework?

查看:64
本文介绍了如何从 .NET Framework 构建的项目引用在 .NET Core 中构建的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前收到此错误:

该项目 [...] 的命运是netcoreapp2.1".不能使用.NETFramework,Version=v4.6.1"作为命运来引用此项目.

The project […] has "netcoreapp2.1" as destiny. This Project cannot be referenced with ".NETFramework,Version=v4.6.1" as Destiny.

我收到错误消息,我的项目在 Net 中..NET 代码中的框架和库.好的.

I get the error, my project is in Net. Framework and the library in .NET Code. Ok.

问题是项目显然只能在网络中.框架(它是一种 Windows 形式)而不是其他任何形式,并且库仅在 .NET Core 中,尝试在项目属性中更改它是没有用的.

Problem is that project can apperently only be in Net. Framework (it's a Windows form) and not in any other one, and library only in .NET Core, attempting to change it in project properties is no use.

如何才能实现我所说的?

How can it be achieved what I'm mentioning?

推荐答案

很遗憾,这无法实现.如果你有源代码,你可以将 netcore 项目中的目标更改为 netcore 和 .NET 都可以引用的 netstandard.

Unfortunately, this cannot be achieved. If you do have the source code, you can change the target in the netcore project to netstandard which can be referenced by both netcore and .NET.

这篇关于如何从 .NET Framework 构建的项目引用在 .NET Core 中构建的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆