将.NET Core重新定位为net471,net 472 [英] Re-target .NET Core to net471, net 472

查看:145
本文介绍了将.NET Core重新定位为net471,net 472的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.Netcore 2.0项目可以定位为 net471
但是当我升级到.NET 2.1时,无法重新定位 net471 net472

My .Netcore 2.0 project can target net471. But when I upgraded to .NET 2.1, I can't retarget net471 or net472

我可以重新定位最新版本的.NET内核吗?

Can I retarget in the latest version of .the NET core?

Severity Code Description Project File Line Suppression State
Error NU1202 Package Microsoft.AspNetCore.App 2.1.0 is not compatible with net471 (.NETFramework,Version=v4.7.1). Package Microsoft.AspNetCore.App 2.1.0 supports: netcoreapp2.1 (.NETCoreApp,Version=v2.1) 

Severity Code Description Project File Line Suppression State
Error NU1202 Package Microsoft.AspNetCore.App 2.1.0 is not compatible with net472 (.NETFramework,Version=v4.7.2). Package Microsoft.AspNetCore.App 2.1.0 supports: netcoreapp2.1 (.NETCoreApp,Version=v2.1) 


推荐答案

它看起来像 Microsoft.AspNetCore.App Microsoft.AspNetCore.All 软件包仅适用于 netcoreapp2.0 netcoreapp2.1 版本。

It looks like Microsoft.AspNetCore.App and Microsoft.AspNetCore.All packages only work with the netcoreapp2.0 or netcoreapp2.1 version.

想要定位到.NET Framework,即 net471,net472 ,则必须删除这些软件包并手动添加引用。

Wanting to target .NET Framework i.e. net471, net472, you have to remove these packages and manually add the references.

对于我来说,我删除了 Microsoft.AspNetCore.App 并添加了以下引用。

In my case, I removed Microsoft.AspNetCore.App and added references as below.

<PackageReference Include="Microsoft.AspNetCore" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.WindowsServices" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.1.1" />

这篇关于将.NET Core重新定位为net471,net 472的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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