gpt4 book ai didi

azure-devops - Azure DevOps : Pipeline broken after migrating to . NET 核心 3.0

转载 作者:行者123 更新时间:2023-12-05 09:12:20 25 4
gpt4 key购买 nike

我有一个包含多个 .NET Standard 2.0、.NET Standard 2.1、.NET Core 3.0 和完整的 .NET Framework 4.8 项目的解决方案。管道看起来像这样:

  pool:
name: Azure Pipelines
demands:
- msbuild
- visualstudio

variables:
BuildPlatform: 'any cpu'
BuildConfiguration: 'release'

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 3.0'
inputs:
version: 3.0.100

- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '**/*.csproj'

- task: NuGetToolInstaller@1
displayName: 'Use NuGet 4.9.1'
inputs:
versionSpec: 4.9.1
checkLatest: true

- task: NuGetCommand@2
displayName: 'NuGet restore'

- task: VSBuild@1
displayName: 'Build solution **\*.sln'
inputs:
vsVersion: 16.0
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
clean: true

- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: test
projects: '**/*tests.csproj'

- task: PublishSymbols@2
displayName: 'Publish symbols path'
inputs:
PublishSymbols: false

安装正确的 SDK 版本后,管道运行 dotnet restore 以下载 .NET Standard 和 .NET Core 项目使用的所有 NuGet 包。之后,它安装 NuGet 并使用它来恢复完整 .NET Framework 项目使用的 NuGet 包。

然而,迁移到 .NET Core 3.0 后,NuGet 恢复失败并出现以下错误:

[error] The nuget command failed with exit code(1) and error(NU1202: Package Microsoft.EntityFrameworkCore.SqlServer 3.0.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.EntityFrameworkCore.SqlServer 3.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)

NU1202: Package Microsoft.EntityFrameworkCore.Tools 3.0.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.EntityFrameworkCore.Tools 3.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1) NU1202: Package Microsoft.EntityFrameworkCore.Relational 3.0.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.EntityFrameworkCore.Relational 3.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1) Errors in d:\a\1\s\Pagesp.ChaveMovel.AspNetCore.Site.Identity.v2\Pagesp.ChaveMovel.AspNetCore.Site.Identity.v2.csproj NU1202: Package Microsoft.EntityFrameworkCore.SqlServer 3.0.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.EntityFrameworkCore.SqlServer 3.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1) NU1202: Package Microsoft.EntityFrameworkCore.Tools 3.0.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.EntityFrameworkCore.Tools 3.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1) NU1202: Package Microsoft.EntityFrameworkCore.Relational 3.0.0 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.EntityFrameworkCore.Relational 3.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1))

[error] Packages failed to restore

关于如何解决这个问题的任何想法?

最佳答案

1) 我成功地使用以下方法重现了您的问题:

  • 您的管道
  • 示例项目 ( source )

2) 我注释掉了 Nuget Task 中的 versionSpec,之后管道成功完成:

- task: NuGetToolInstaller@1
displayName: 'Use NuGet 4.9.1'
inputs:
# versionSpec: 4.9.1
checkLatest: true

3)自动安装的NuGet版本为5.3.0

关于azure-devops - Azure DevOps : Pipeline broken after migrating to . NET 核心 3.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58458690/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com