无法在管道中建立.Net 5 [英] Can't build .Net 5 in pipeline

查看:67
本文介绍了无法在管道中建立.Net 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

2周前,我使用.Net 5 RC2创建了一个新的解决方案.我已经将其升级到新版本(5.0.0).我正在尝试创建一个标准的ASP.Net管道来构建它,代理程序池是Azure管道,并且代理规范我已经尝试了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:\a\1\s\XXX\obj\XXX.csproj.nuget.g.props.
Generating MSBuild file D:\a\1\s\XXX\obj\XXX.csproj.nuget.g.targets.
Writing lock file to disk. Path: D:\a\1\s\XXX\obj\project.assets.json
Writing cache file to disk. Path: D:\a\1\s\XXX\obj\XXX.csproj.nuget.cache
Restore failed in 38.96 sec for D:\a\1\s\XXX\XXX.csproj.
NuGet Config files used:
D:\a\1\Nuget\tempNuGet_3.config
Feeds used:
https://api.nuget.org/v3/index.json
Installed:
71 package(s) to D:\a\1\s\XXX\XXX.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:\a\1\s\XXX\XXX.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构建,并在其之前放置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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆