We run self-hosted agents for our dev.azure.com pipelines. Some projects require specific NetFramework or NetCore versions but we don't want to install 20 years of old versions on all agent machines. (There are lots of SDK versions).
I can see that agent capabilities and demands provide the functionality to make sure a build is only run on a capable agent.
But how do I specify a demand for a specific NetFramework SDK version e.g. 4.8.1? I can't find a list of well known capability names that an agent might report.
No sure whether some of your agents have such capabilities as those of one of my agent's in the Default
self-hosted pool below. If not, you may add a user-defined capablity to demand
the agent job to run on the expected agents.
Taking my YAML pipeline for example, either agent job managed to pick up the expected agents.
jobs:
- job: ReferenceSystemCapabilities
pool:
name: Default
demands:
- Agent.OS -equals Windows_NT
- DotNetFramework_4.8.0
- DotNetFramework_4.8.0_x64
steps:
- pwsh: |
Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse |
Get-ItemProperty -Name Version,Release -ErrorAction SilentlyContinue |
Where-Object { $_.PSChildName -match '^(?!S)\p{L}'} |
Select-Object PSChildName, Version, Release
- job: ReferenceUserDefinedCapabilities
pool:
name: Default
demands:
- DotNetFrameworkVersion -equals 4.8.0
steps:
- pwsh: |
Get-ChildItem -Path 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -Recurse |
Get-ItemProperty -Name Version,Release -ErrorAction SilentlyContinue |
Where-Object { $_.PSChildName -match '^(?!S)\p{L}'} |
Select-Object PSChildName, Version, Release