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

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

问题描述

我的 .Netcore 2.0 项目可以针对 net471.但是当我升级到 .NET 2.1 时,我无法重定向 net471net472

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

我可以在最新版本的 .the NET Core 中重新定位吗?

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.AppMicrosoft.AspNetCore.All 包只适用于netcoreapp2.0netcoreapp2.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天全站免登陆