简体   繁体   English

将 .net 核心 2.2 迁移到 3.1 问题

[英]migrate .net core 2.2 to 3.1 issue

After installing .NET core SDK 3.1 and upgrading all my projects' SDK [in my solution] from .NET core SDK 2.2 to 3.1, and updating all packages such as extension to 3.1 version, I successfully built all projects in my solution.安装 .NET core SDK 3.1 并将我所有项目的 SDK [在我的解决方案中] 从 .NET core SDK 2.2 升级到 3.1,并将扩展等所有包更新到 3.1 版本后,我成功地构建了我的解决方案中的所有项目。

But then I got this error:但后来我得到了这个错误:

C:\Program Files\do.net\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(59,5): error.NETSDK1083: The specified RuntimeIdentifier 'win7-64' is not recognized. C:\Program Files\do.net\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(59,5): error.NETSDK1083 : 指定的RuntimeIdentifier 'win7 -64' 无法识别。 C:\Program Files\do.net\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(59,5): error.NETSDK1083: The specified RuntimeIdentifier 'win7-86' is not recognized. C:\Program Files\do.net\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(59,5): error.NETSDK1083 : 指定的RuntimeIdentifier 'win7 -86' 未被识别。

This is my WebApi.csproj:这是我的 WebApi.csproj:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup Label="Globals">
    <SccProjectName>SAK</SccProjectName>
    <SccProvider>SAK</SccProvider>
    <SccAuxPath>SAK</SccAuxPath>
    <SccLocalPath>SAK</SccLocalPath>
  </PropertyGroup>

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <PropertyGroup>
    <RuntimeIdentifiers>win7-64;win7-86;ubuntu.16.04-x64;win10-x64;osx.10.11-x64</RuntimeIdentifiers>
  </PropertyGroup>

  <PropertyGroup>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
    <LangVersion>7.1</LangVersion>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <NoWarn>1591</NoWarn>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <NoWarn>1701;1702;1591</NoWarn>
  </PropertyGroup>

  <ItemGroup>
    <None Remove="swagger.css" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="xxxxxx" Version="x.x.x" />
  </ItemGroup>


  <ItemGroup>
    <ProjectReference Include="..\xxxx.csproj" />
  </ItemGroup>

</Project>

as @Neil said正如@Neil所说

Remove the whole 'runtimeIdentifiers' section, you only need it if you are doing cross-platform work.删除整个“runtimeIdentifiers”部分,只有在进行跨平台工作时才需要它。

this way solved my problem.这样解决了我的问题。

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

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