无法在管道中构建 .Net 5 [英] Can't build .Net 5 in pipeline
问题描述
我两周前使用 .Net 5 RC2 创建了一个新的解决方案.我已将其升级到新版本 (5.0.0).我正在尝试创建一个标准的 ASP.Net 管道来构建它,代理池是 Azure Pipelines,代理规范我已经尝试了 windows-2019 和 vs2017-win2016.两者都给出与下面相同的错误为什么要尝试使用 2.1?
I created a new solution 2 weeks ago using .Net 5 RC2. I've upgraded it to the new release (5.0.0). I'm trying to created a standard ASP.Net pipeline to build it, agent pool is Azure Pipelines, and agent specification I've tried both windows-2019 and vs2017-win2016. Both give the same errors as below Why is it trying to use 2.1?
Checking compatibility for System.Composition.AttributedModel 1.0.31 with .NETFramework,Version=v5.0 (win7-x86).
Checking compatibility for System.Composition.Runtime 1.0.31 with .NETFramework,Version=v5.0 (win7-x86).
Checking compatibility for System.Composition.TypedParts 1.0.31 with .NETFramework,Version=v5.0 (win7-x86).
Incompatible packages: 4
Committing restore...
Generating MSBuild file D:a1sXXXobjXXX.csproj.nuget.g.props.
Generating MSBuild file D:a1sXXXobjXXX.csproj.nuget.g.targets.
Writing lock file to disk. Path: D:a1sXXXobjproject.assets.json
Writing cache file to disk. Path: D:a1sXXXobjXXX.csproj.nuget.cache
Restore failed in 38.96 sec for D:a1sXXXXXX.csproj.
NuGet Config files used:
D:a1Nuget empNuGet_3.config
Feeds used:
https://api.nuget.org/v3/index.json
Installed:
71 package(s) to D:a1sXXXXXX.csproj
##[error]The nuget command failed with exit code(1) and error(NU1202: Package Microsoft.EntityFrameworkCore.SqlServer 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0). Package Microsoft.EntityFrameworkCore.SqlServer 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package Microsoft.EntityFrameworkCore.Tools 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0). Package Microsoft.EntityFrameworkCore.Tools 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package Microsoft.EntityFrameworkCore.Design 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0). Package Microsoft.EntityFrameworkCore.Design 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package Microsoft.EntityFrameworkCore.Relational 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0). Package Microsoft.EntityFrameworkCore.Relational 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package Microsoft.EntityFrameworkCore.SqlServer 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0) / win7-x86. Package Microsoft.EntityFrameworkCore.SqlServer 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package Microsoft.EntityFrameworkCore.Tools 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0) / win7-x86. Package Microsoft.EntityFrameworkCore.Tools 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package Microsoft.EntityFrameworkCore.Relational 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0) / win7-x86. Package Microsoft.EntityFrameworkCore.Relational 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package Microsoft.EntityFrameworkCore.Design 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0) / win7-x86. Package Microsoft.EntityFrameworkCore.Design 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
Errors in D:a1sXXXXXX.csproj
NU1202: Package Microsoft.EntityFrameworkCore.SqlServer 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0). Package Microsoft.EntityFrameworkCore.SqlServer 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package Microsoft.EntityFrameworkCore.Tools 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0). Package Microsoft.EntityFrameworkCore.Tools 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package Microsoft.EntityFrameworkCore.Design 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0). Package Microsoft.EntityFrameworkCore.Design 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package Microsoft.EntityFrameworkCore.Relational 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0). Package Microsoft.EntityFrameworkCore.Relational 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package Microsoft.EntityFrameworkCore.SqlServer 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0) / win7-x86. Package Microsoft.EntityFrameworkCore.SqlServer 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package Microsoft.EntityFrameworkCore.Tools 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0) / win7-x86. Package Microsoft.EntityFrameworkCore.Tools 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package Microsoft.EntityFrameworkCore.Relational 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0) / win7-x86. Package Microsoft.EntityFrameworkCore.Relational 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1)
NU1202: Package Microsoft.EntityFrameworkCore.Design 5.0.0 is not compatible with net50 (.NETFramework,Version=v5.0) / win7-x86. Package Microsoft.EntityFrameworkCore.Design 5.0.0 supports: netstandard2.1 (.NETStandard,Version=v2.1))
##[error]Packages failed to restore
Finishing: NuGet restore ```
推荐答案
它使用的是旧版本的 Nuget.
It was using an older version of Nuget.
我在还原前将其更改为 5.x,现在可以使用了.
I changed it to 5.x before the restore and it works now.
管道 yaml
- task: NuGetToolInstaller@1
inputs:
versionSpec: 4.x.x
然后遇到了构建不起作用的问题,因为 MSBuild 16.8 尚未发布.改为 dotnet build 并把 Use Dotnet 5 任务放在它之前
Then ran into a problem of build not working because MSBuild 16.8 not released yet. Changed to dotnet build and put Use Dotnet 5 task before it
这篇关于无法在管道中构建 .Net 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!