0

I've installed the latest VS Build Tools (2022), but my on-prem build agent isn't picking up the VisualStudio-related capabilities. I've been under the impression that we no longer need to install the full application in order to get these capabilities.

An example from this blog post:

enter image description here

I've added all workloads to my offline layout, and I've included them in my installation.

I know this is possible, because earlier I accidentally included Python and VS 2019 Build Tools in my Node.js installation configuration. The VS-related capabilities were found by the agent then.

But I'm trying to get 2022, so I uninstalled 2019.

How can I get the 2022 VS-related capabilities to be installed and detected by my build agent, without installing the full Visual Studio product?

InteXX
  • 6,135
  • 6
  • 43
  • 80
  • Sometimes you can work around this by manually setting the VS capability (it's just a string) yourself in the agent settings. Sometimes DevOps fails to automatically recognize that VS is installed on the agent; don't know why. – Conrad Albrecht Feb 07 '22 at 16:36
  • That's just it... I want to avoid installing VS on the agent. The 2019 installation offered up the capabilities, so it stands to reason that 2022 should as well. There's also [this](https://github.com/Microsoft/azure-pipelines-agent/issues/871#issuecomment-329101209) from four and a half years ago. – InteXX Feb 07 '22 at 19:13
  • Partial duplicate: https://stackoverflow.com/a/70627423/736079 – jessehouwing Feb 08 '22 at 00:04

1 Answers1

2

You need to upgrade the agent to a recent enough version. You can download the agent from the azure-pipelines-agent repository's releases page. Or manually specify the capabilities.

You may need to set a special environment flag on the agent to prevent it from automatically being downgraded to whatever version shipped with your version if Azure DevOps Server or Team Foundation Server.

And then you'll also need to install the latest version of the vsbuild/msbuild and vstest tasks

Required agent version

You will need to install the most recent agent from the azure-pipelines-agent repository for it to auto-detect Visual Studio 2022, or alternatively add the capabilities to the agent manually.

You may need to force Azure DevOps Server to not downgrade back to its preferred agent version. You can do so by setting the following environment variable at the system level on your server before launching the agent:

 AZP_AGENT_DOWNGRADE_DISABLED=true 

These tricks will work for most tasks in the azure-pipelines-tasks repository, as long as it doesn't depend on a UI extension or service connection type that isn't available in your version of Azure DevOps Server.

https://jessehouwing.net/adding-visual-studio-2022-to-azure-devops-server-2020/

InteXX
  • 6,135
  • 6
  • 43
  • 80
jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • OK, I'm game... `"And then you'll also need to install the latest version of the vsbuil[d]/msbuild and vstest tasks"` For example, I found [this](https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/build/visual-studio-build?view=azure-devops-2020). Does this mean that this is going to be a YAML-only affair? – InteXX Feb 08 '22 at 02:03
  • No, those tasks work with the old UI builds as well. But YAML is the future. – jessehouwing Feb 08 '22 at 06:50
  • 1
    Oh yes, of course. It's only that I haven't graduated into that class yet. I've got too much on my plate at the moment as it is. I must pace myself. – InteXX Feb 08 '22 at 07:07
  • I'll give this a go asap and let you know my progress. Thanks. – InteXX Feb 08 '22 at 07:08
  • I'm stuck on your VSTest task: [link](https://github.com/jessehouwing/azure-pipelines-tasks-zips/releases/tag/m200). There are two files to download, #1 & #2, with significant differences between them. When should a person use one over the other? – InteXX Feb 08 '22 at 23:46
  • I installed them both, but 2022 isn't showing up in the task's Test Platform version list (after refreshing the page). – InteXX Feb 08 '22 at 23:54
  • 2
    I was able to find a workaround: the VS Test Platform Installer task. I'm making heavy use of the Task Groups feature in all my pipelines, so this isn't much of an imposition at all. – InteXX Feb 09 '22 at 00:59
  • You'll see that for some tasks there is a V1, V2 etc. Azure Pipeline offers both versions in it's drop-down. If you're up to date, you only need the latest one. But you can push both if you want to. – jessehouwing Feb 09 '22 at 07:52
  • Very good, thank you. Thanks for all your help. – InteXX Feb 09 '22 at 22:03