16

我想更新我的包,但我遇到了一些这样的错误:

错误是:

错误 NU1202 包 Microsoft.EntityFrameworkCore.Sqlite 5.0.0-rc.1.20451.13 与 net50 (.NETFramework,Version=v5.0) / win7-x86 不兼容。包 Microsoft.EntityFrameworkCore.Sqlite 5.0.0-rc.1.20451.13 支持:netstandard2.1 (.NETStandard,Version=v2.1) API E:...\API\API.csproj 1

API.csproj 文件:

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

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.0.1" />
    <PackageReference Include="CloudinaryDotNet" Version="1.11.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.7" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.0-preview.8.20414.8" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.0-preview.8.20407.4">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.0-preview.8.20407.4" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.0-preview8" />
    <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.7.1" />
  </ItemGroup>

</Project>

nuget 包管理器

C:\WINDOWS\system32>dotnet --info .NET SDK(反映任何 global.json):
版本:5.0.100-rc.1.20452.10
提交:473d1b592e

运行环境:
操作系统名称:Windows
操作系统版本:10.0.17763 操作系统平台:Windows
RID:win10-x64
基本路径:C:\Program Files\dotnet\sdk\5.0.100-rc.1.20452.10\

命令行

我怎么解决这个问题?

4

6 回答 6

26

我遇到过同样的问题:

我将我的 Visual Studio 程序从16.7版更新到16.8版,现在问题解决了!

我手动检查了更新

这个解决方案写在这个问题的评论中,但我想把它作为一个答案来帮助像我这样的人

于 2020-12-14T07:44:05.680 回答
12

您必须将 nuget 安装程序升级到最新版本。

https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite/

https://www.nuget.org/downloads

如果您使用的是 Azure Devops,则可以将任务步骤添加到管道中。

- task: UseDotNet@2
      inputs:
        packageType: sdk
        version: 5.0.x

- task: NuGetToolInstaller@1
      inputs:
        versionSpec: ''
        checkLatest: true
于 2020-12-06T11:37:58.500 回答
4

要开发任何 ASP.NET Core 5.0 应用,您需要 Visual Studio 2019 版本 16.8 或更高版本,并安装 ASP.NET 和 Web 开发工作负载。

https://docs.microsoft.com/en-us/dotnet/core/install/windows?tabs=net50

https://docs.microsoft.com/en-us/dotnet/architecture/grpc-for-wcf-developers/create-project

于 2021-07-08T11:24:45.113 回答
0

我的项目中有一个 global.json 文件。删除后问题得到修复,因为它提到了 .net core 3.1 sdk。

于 2020-12-10T14:50:28.907 回答
0

在记事本中打开 .csproj 文件并将目标版本从 3.1 更改为 2.1 从

<TargetFramework>netstandard5.0</TargetFramework>

<TargetFramework>netstandard2.1</TargetFramework>

保存文件并关闭。清洁解决方案,然后重建解决方案。

于 2021-08-05T02:11:53.390 回答
0

要研究的另一件事是,当您尝试构建它以在 Visual Studio 2019 中运行它时 - 而不是任何先前版本。
我只是在运行它并提供了相同的错误。我很幸运,注意到这是2017年,不支持.NET Core 5.
选择与2019年开放时,我做了一个干净和重建,一切都很好。(更改您的默认应用程序。)

于 2021-10-10T04:18:36.013 回答