简体   繁体   English

如何更新我的 Azure DevOps 内部部署管道任务以包括 MSBuild v17 和 Visual Studio 2022?

[英]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 个选项。

  1. Download the tasks from an existing Azure DevOps organization (cloud version).从现有 Azure DevOps 组织(云版本)下载任务。 Then use tfx or PowerShell to upload the upgraded tasks to your Azure DevOps server.然后使用 tfx 或 PowerShell 将升级后的任务上传到您的 Azure DevOps 服务器。
  2. Build the tasks from source and publish them to your Azure DevOps server.从源代码构建任务并将它们发布到您的 Azure DevOps 服务器。

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
    }
}

Until we can update our DevOps version itself, we installed Build Tools 2022 and set the msbuild path (instead of the version) in the build task settings:在我们可以更新我们的 DevOps 版本之前,我们安装了 Build Tools 2022 并在构建任务设置中设置了 msbuild 路径(而不是版本):

MSBuild 位置<\/a>

"

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.

相关问题 在(本地 linux 代理)mysql 服务器上执行 mysql 脚本任务? - Executing mysql scripts tasks on (on-premise linux agent) mysql server using Azure DevOps Release pipeline? 如何将 azure-devops 命令添加到离线本地服务器中的 Azure CLI? - How do I add the azure-devops commands to the Azure CLI in an offline on-premise server? 如何将 Visual Studio 2022 连接到 Azure DevOps? - How to connect Visual Studio 2022 to Azure DevOps? Azure DevOps内部部署成本 - Azure DevOps on-premise costs 如何在本地 Azure DevOps 2019 中更改工作项图标 - How to change work item icons in on-premise Azure DevOps 2019 如何将 YAML 中的计划触发器与本地 Azure DevOps 2019 一起使用? - How to use the schedule trigger in YAML with on-premise Azure DevOps 2019? DevOps Release Pipeline 本地 TaskModuleSqlUtility - DevOps Release Pipeline on-premise TaskModuleSqlUtility 如何从 Azure DevOps 构建 .NET Core 辅助服务并将其部署到本地环境 - How can I build and deploy a .NET Core worker service to on-premise environment from Azure DevOps Azure DevOps On-Premise - 如何停止和删除远程计算机上的 Windows 服务? - Azure DevOps On-Premise - How can I stop and delete a windows service on a remote machine? Mac 上的 Visual Studio 2022 Azure Devops 存储库 - Visual Studio 2022 on Mac Azure Devops Repository
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM