You can build Microsoft's task yourself and push these tasks directly into your project collection using tfx-cli. You can also create an extension containing these updates tasks and install that into your collection.
To build the tasks you can run this script in PowerShell 7:
$tasksToBuild = @("VSBuildV1", "VsTestV1", "VsTestV2", "VsTestPlatformToolInstallerV1",
"MSBuildV1", "DotNetCoreInstallerV1", "DotNetCoreCLIV2")
$outputDir = md _build -force
$extensionManifest = gc "vss-extension.json" | ConvertFrom-Json
$extensionManifest.contributions = @()
& git clone https://github.com/microsoft/azure-pipelines-tasks.git --quiet
cd azure-pipelines-tasks
& git config --local pager.branch false
$branches = & git branch -r
$version = (($branches | Select-String -pattern "(?<=origin/releases/m)\d+$").Matches) | %{ [int32]$_.Value } | measure-object -maximum
$version = $version.Maximum
& git reset --hard origin/releases/m$version
npm install
Write-Host "Building tasks..."
foreach ($task in $tasksToBuild)
{
Write-Host "Building $task..."
& node make.js build --task $task
Write-Host "Building $task done."
$taskDir = "$outputDir/$task"
copy "./_build/Tasks/$task" $taskDir -Recurse
Write-Host "Updating contributions..."
$extensionManifest.contributions += @{
"id" = "$task"
"type" = "ms.vss-distributed-task.task"
"targets" = @("ms.vss-distributed-task.tasks")
"properties" = @{
"name" = "_build/$task"
}
}
}
cd ..
$extensionManifest.version = "1.$version.0"
$extensionManifest | ConvertTo-Json -depth 100 | Out-File "vss-extension.json" -Encoding utf8NoBOM
& npm install tfx-cli -g
& tfx extension create --manifests vss-extension.dev.json vss-extension.json --output tasks.vsix
From:
Make sure you have an extension manifest available in the folder when you run this script. You can look at this repo for an example:
Replace the contents of build.ps1
with the script above, update the vss-extension.*.json files with your own publisher and extensionid and it should spit out an extension for you.
That way you'll get a copy of the exact tasks Microsoft published in the latest release of Azure DevOps (cloud).
I've documented these steps along with a few more options on my blog.