构建 .NET 5.0 项目 Azure DevOps 管道 [英] Building .NET 5.0 project Azure DevOps pipeline
本文介绍了构建 .NET 5.0 项目 Azure DevOps 管道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 Azure DevOps 管道构建在 .NET 5.0 中构建一个项目,但收到此错误
I'm trying to build a project in .NET 5.0 using Azure DevOps pipeline Build and I'm received this error
2020-11-14T01:59:45.8238544Z [command]"C:Program Filesdotnetdotnet.exe" build D:a1sXXX.csproj "-dl:CentralLogger,"D:a\_tasksDotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b2.178.0dotnet-build-helpersMicrosoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"*ForwardingLogger,"D:a\_tasksDotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b2.178.0dotnet-build-helpersMicrosoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll""
2020-11-14T01:59:46.1472016Z Microsoft (R) Build Engine version 16.7.0+7fb82e5b2 for .NET
2020-11-14T01:59:46.1473316Z Copyright (C) Microsoft Corporation. All rights reserved.
2020-11-14T01:59:46.1473902Z
2020-11-14T01:59:46.6006398Z Determining projects to restore...
2020-11-14T01:59:47.2059773Z Restored D:a1sXXX.csproj (in 234 ms).
2020-11-14T01:59:47.2119638Z 1 of 2 projects are up-to-date for restore.
2020-11-14T01:59:47.3209350Z ##[error]C:Program Filesdotnetsdk3.1.403Microsoft.Common.CurrentVersion.targets(1177,5): Error MSB3644: The reference assemblies for .NETFramework,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
2020-11-14T01:59:47.3261839Z C:Program Filesdotnetsdk3.1.403Microsoft.Common.CurrentVersion.targets(1177,5): error MSB3644: The reference assemblies for .NETFramework,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [D:a1sXXX.csproj]
2020-11-14T01:59:47.3270768Z
2020-11-14T01:59:47.3274231Z Build FAILED.
2020-11-14T01:59:47.3275925Z
2020-11-14T01:59:47.3277393Z C:Program Filesdotnetsdk3.1.403Microsoft.Common.CurrentVersion.targets(1177,5): error MSB3644: The reference assemblies for .NETFramework,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks [D:a1sXXX.csproj]
2020-11-14T01:59:47.3279484Z 0 Warning(s)
2020-11-14T01:59:47.3279860Z 1 Error(s)
2020-11-14T01:59:47.3280170Z
2020-11-14T01:59:47.3280537Z Time Elapsed 00:00:01.09
2020-11-14T01:59:47.3624731Z ##[error]Error: The process 'C:Program Filesdotnetdotnet.exe' failed with exit code 1
有人知道 Azure DevOps 管道是否支持构建 .NET 5.0 代码?
Does someone know if Azure DevOps pipelines have support for building .NET 5.0 code ?
推荐答案
是的,Azure DevOps Pipelines 可以构建 net5.0
应用.
Yes, Azure DevOps Pipelines can build net5.0
apps.
如果您使用.Net Core"进行构建(yaml 中的 DotNetCoreCLI
)任务 - 添加使用 .NET Core";(UseDotNet
in yaml) 在它之前的任务,使用正确的版本:
If you are building with ".Net Core" (DotNetCoreCLI
in yaml) task - add "Use .NET Core" (UseDotNet
in yaml) task before it, with correct version:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '5.0.x'
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: 'build'
这篇关于构建 .NET 5.0 项目 Azure DevOps 管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文