[英]Azure Devops - Hosted pool - ubuntu latest - How do i get ubuntu-latest to have the latest visual studio build tools (preview 2022)?
Our azure devops pipelines are configured to use hosted ubuntu-latest我们的 azure devops 管道配置为使用托管的 ubuntu-latest
I am using Azure Functions that require the package: packages/microsoft.net.sdk.functions/4.0.0 The hosted ubuntu latest is throwing non compatible framework version error.我正在使用需要包的 Azure 函数:packages/microsoft.net.sdk.functions/4.0.0 托管的 ubuntu 最新版本抛出不兼容的框架版本错误。
/home/vsts/.nuget/packages/microsoft.net.sdk.functions/4.0.0/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5):
error : It was not possible to find any compatible framework version
/home/vsts/.nuget/packages/microsoft.net.sdk.functions/4.0.0/build/Microsoft.NET.Sdk.Functions.Build.targets(32,5):
error : The framework 'Microsoft.NETCore.App', version
'6.0.0-rc.1.21451.13' was not found.**
When changing the pool to run on an on premise build agent, I was able to install the latest build tools (the one that comes with visual studio 2022 preview) and everything works fine.当更改池以在本地构建代理上运行时,我能够安装最新的构建工具(visual studio 2022 预览版附带的工具)并且一切正常。 My question is how do I get the ubuntu-latest to have the latest dotnet build tools?
我的问题是如何让 ubuntu-latest 拥有最新的 dotnet 构建工具?
This is the output of dotnet info of the ubuntu-latest agent.这是 ubuntu-latest 代理的dotnet 信息的输出。
2021-10-27T04:54:16.4629465Z .NET SDKs installed:
2021-10-27T04:54:16.4630372Z 2.1.302 [/usr/share/dotnet/sdk]
2021-10-27T04:54:16.4630865Z 2.1.403 [/usr/share/dotnet/sdk]
2021-10-27T04:54:16.4631327Z 2.1.526 [/usr/share/dotnet/sdk]
2021-10-27T04:54:16.4631821Z 2.1.617 [/usr/share/dotnet/sdk]
2021-10-27T04:54:16.4632292Z 2.1.701 [/usr/share/dotnet/sdk]
2021-10-27T04:54:16.4632746Z 2.1.818 [/usr/share/dotnet/sdk]
2021-10-27T04:54:16.4633218Z 3.1.120 [/usr/share/dotnet/sdk]
2021-10-27T04:54:16.4633687Z 3.1.202 [/usr/share/dotnet/sdk]
2021-10-27T04:54:16.4634147Z 3.1.302 [/usr/share/dotnet/sdk]
2021-10-27T04:54:16.4634616Z 3.1.414 [/usr/share/dotnet/sdk]
2021-10-27T04:54:16.4635086Z 5.0.104 [/usr/share/dotnet/sdk]
2021-10-27T04:54:16.4635541Z 5.0.208 [/usr/share/dotnet/sdk]
2021-10-27T04:54:16.4636008Z 5.0.303 [/usr/share/dotnet/sdk]
2021-10-27T04:54:16.4636462Z 5.0.402 [/usr/share/dotnet/sdk]
2021-10-27T04:54:16.4636703Z
2021-10-27T04:54:16.4637082Z .NET runtimes installed:
2021-10-27T04:54:16.4637683Z Microsoft.AspNetCore.All 2.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
2021-10-27T04:54:16.4638405Z Microsoft.AspNetCore.All 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
2021-10-27T04:54:16.4639112Z Microsoft.AspNetCore.All 2.1.12 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
2021-10-27T04:54:16.4639839Z Microsoft.AspNetCore.All 2.1.24 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
2021-10-27T04:54:16.4640553Z Microsoft.AspNetCore.All 2.1.30 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
2021-10-27T04:54:16.4641691Z Microsoft.AspNetCore.App 2.1.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
2021-10-27T04:54:16.4642420Z Microsoft.AspNetCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
2021-10-27T04:54:16.4643130Z Microsoft.AspNetCore.App 2.1.12 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
2021-10-27T04:54:16.4643823Z Microsoft.AspNetCore.App 2.1.24 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
2021-10-27T04:54:16.4644541Z Microsoft.AspNetCore.App 2.1.30 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
2021-10-27T04:54:16.4645263Z Microsoft.AspNetCore.App 3.1.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
2021-10-27T04:54:16.4645958Z Microsoft.AspNetCore.App 3.1.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
2021-10-27T04:54:16.4646889Z Microsoft.AspNetCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
2021-10-27T04:54:16.4647598Z Microsoft.AspNetCore.App 5.0.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
2021-10-27T04:54:16.4648286Z Microsoft.AspNetCore.App 5.0.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
2021-10-27T04:54:16.4648995Z Microsoft.AspNetCore.App 5.0.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
2021-10-27T04:54:16.4649693Z Microsoft.NETCore.App 2.1.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
2021-10-27T04:54:16.4650357Z Microsoft.NETCore.App 2.1.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
2021-10-27T04:54:16.4651045Z Microsoft.NETCore.App 2.1.12 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
2021-10-27T04:54:16.4651737Z Microsoft.NETCore.App 2.1.24 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
2021-10-27T04:54:16.4652407Z Microsoft.NETCore.App 2.1.30 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
2021-10-27T04:54:16.4653101Z Microsoft.NETCore.App 3.1.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
2021-10-27T04:54:16.4653781Z Microsoft.NETCore.App 3.1.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
2021-10-27T04:54:16.4654445Z Microsoft.NETCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
2021-10-27T04:54:16.4655124Z Microsoft.NETCore.App 5.0.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
2021-10-27T04:54:16.4655799Z Microsoft.NETCore.App 5.0.9 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
2021-10-27T04:54:16.4656459Z Microsoft.NETCore.App 5.0.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
2021-10-27T04:54:16.4656807Z
use this in your pipeline definition:在您的管道定义中使用它:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
version: 6.0.x
includePreviewVersions: true
To explain, firstly Visual Studio only runs on Windows, so you can't install Visual Studio on Linux, but that's fine because you actually only want the .NET SDK.解释一下,首先 Visual Studio 只能在 Windows 上运行,所以你不能在 Linux 上安装 Visual Studio,但这很好,因为你实际上只想要 .NET SDK。 Secondly, both Visual Studio 2022 and .NET 6 are in preview.
其次,Visual Studio 2022 和 .NET 6 都处于预览阶段。
Next, Azure DevOps have documented what software is pre-installed on all their hosted agents: https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#software接下来,Azure DevOps 记录了在其所有托管代理上预安装了哪些软件: https ://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs =yaml#软件
If you follow the link to .NET Core SDK on Ubuntu 20.04 (latest) , you see that they only pre-install Generally Available (GA; released) versions of the .NET SDK, not preview versions.如果您点击Ubuntu 20.04 (latest) 上的 .NET Core SDK链接,您会看到它们只预安装了 .NET SDK 的通用(GA;已发布)版本,而不是预览版本。 After all, most customers building their production applications don't want the risk of using preview tools that might have bugs and break their builds.
毕竟,大多数构建生产应用程序的客户不希望冒使用可能存在错误和破坏构建的预览工具的风险。
So, if you want a preview .NET SDK, you need to explicitly install it as part of your build steps.因此,如果您想要预览 .NET SDK,您需要在构建步骤中明确安装它。 The UseDotNet task does that, allowing you to specify a bunch of parameters, but in this case the most important two are version and include preview versions.
UseDotNet 任务就是这样做的,允许您指定一堆参数,但在这种情况下,最重要的两个是版本和包含预览版本。
For other scenarios, for example anyone not using Azure Pipelines, the .NET team also have dotnet-install scripts , which you can download and execute in your pipeline.对于其他方案,例如任何不使用 Azure Pipelines 的人,.NET 团队也有dotnet-install 脚本,您可以下载并在您的管道中执行。
For what it's worth, .NET 6 is having a launch party on the 9th to the 11th of November , and Visual Studio 2022 is having a launch event on the 8th of November .值得一提的是, .NET 6 将于 11 月 9 日至 11 日举行发布会,而Visual Studio 2022 将于 11 月 8 日举行发布会。 I don't know how quickly Azure DevOps will update their VM images with the newly released tools, but I guess it will be within days, so installing preview tooling in your build scripts won't be needed for much longer, unless you want to keep using preview tools.
我不知道 Azure DevOps 会以多快的速度使用新发布的工具更新他们的 VM 映像,但我想它会在几天内完成,因此在构建脚本中安装预览工具的时间不会太长,除非您想继续使用预览工具。 Note that once .NET 6 SDK's 6.0.100 goes GA, then the script that installs preview 6.0.x tooling will start installing the preview 6.0.200 previews
请注意,一旦 .NET 6 SDK 的 6.0.100 正式发布,安装预览版 6.0.x 工具的脚本将开始安装预览版 6.0.200 预览版
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.