我有一个包含几个净标准2.0,净标准2.1,净核心3.0和完整净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标准和net核心项目使用的所有nuget软件包。之后,它将安装Nuget并使用它还原整个网络框架项目使用的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
关于如何解决此问题的任何想法?
答案 0 :(得分:3)
1)我设法使用以下方法来复制您的问题:
2)我在Nuget Task中评论了nuget的versionSpec,并且管道已成功完成。
- task: NuGetToolInstaller@1
displayName: 'Use NuGet 4.9.1'
inputs:
# versionSpec: 4.9.1
checkLatest: true
3)自动安装的Nuget版本是5.3.0