[英]How do I update my Azure DevOps on-premise Pipeline tasks to include MSBuild v17 and Visual Studio 2022?
How do I update my on-premise, Azure Devops Pipeline tasks to include the new MSBuild v17 and Visual Studio 2022 build tasks?如何更新我的本地 Azure Devops 管道任务以包括新的 MSBuild v17 和 Visual Studio 2022 构建任务?
I found the updated MSBuild task here:我在这里找到了更新的 MSBuild 任务:
https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/MSBuildV1 https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/MSBuildV1
I found the old MSBuild v16 task installed here:我发现这里安装了旧的 MSBuild v16 任务:
C:\Program Files\Azure DevOps Server 2020\Tools\Deploy\TfsServicingFiles\Tasks\Individual\MSBuildV1\ C:\Program Files\Azure DevOps Server 2020\Tools\Deploy\TfsServicingFiles\Tasks\Individual\MSBuildV1\
What is the proper method to update this?更新这个的正确方法是什么?
You have 2 options.您有 2 个选项。
I've outlined the process in a blog post:我在一篇博文中概述了这个过程:
https://jessehouwing.net/adding-visual-studio-2022-to-azure-devops-server-2020/ https://jessehouwing.net/adding-visual-studio-2022-to-azure-devops-server-2020/
The script below is the safest, as it used the exact versions that were pushed to Azure DevOps service.下面的脚本是最安全的,因为它使用推送到 Azure DevOps 服务的确切版本。
$tasksToDownload = @("VSBuild", "VsTest", "VsTestPlatformToolInstaller",
"MSBuild", "DotNetCoreInstaller", "DotNetCoreCLI")
$org = "<<insert source org>>"
$pat = "<<insert PAT | Agent Pool (Manage)>>"
$projectCollectionUri = "https://yourtfs/yourcollection"
$url = "https://dev.azure.com/$org"
$header = @{authorization = "Basic $([Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(".:$pat")))"}
$tasks = Invoke-RestMethod -Uri "$url/_apis/distributedtask/tasks" -Method Get -ContentType "application/json" -Headers $header | ConvertFrom-Json -AsHashtable
foreach ($taskName in $tasksToDownload)
{
$taskMetadatas = $tasks.value | ?{ $_.name -ieq $taskName }
foreach ($taskMetadata in $taskMetadatas)
{
$taskid = $taskMetadata.id
$taskversion = "$($taskMetadata.version.major).$($taskMetadata.version.minor).$($taskMetadata.version.patch)"
$taskZip = "$taskName.$taskid.$taskversion.zip"
Invoke-WebRequest -Uri "$url/_apis/distributedtask/tasks/$taskid/$taskversion" -OutFile $taskZip -Headers $header
& tfx build tasks upload --task-zip-path "$taskZip" --service-url $projectCollectionUri
}
}
make sure your path is correct in the MSBuild.exe task.确保您在 MSBuild.exe 任务中的路径正确。 This will work 100%.这将 100% 有效。
Path to MSBuilde => C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe MSBuilde 路径 => C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe
Platform => $(BuildPlatform)平台 => $(BuildPlatform)
Configuration => $(BuildConfiguration)配置 => $(BuildConfiguration)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.