As part of some long-overdue maintenance of my open source NAudio project, I updated to use the latest .NET 6 SDK and switched to the 10.0.18362.0 Windows SDK (1809). This unfortunately broke my Azure Pipelines build because it was hard-coded to use a
windows-2019 which only has Visual Studio 2019 installed.
I switched my
windows-latest which gives you Windows 2022 with Visual Studio 2022 installed. However, this one didn't come with the Windows 10 SDK that I needed. There's a helpful document that lists everything installed on the VM image which for some reason skips over the SDK I needed.
However, after a bit of digging I found that it's very easy to install a specific version of the Windows SDK using, chocolatey, a Windows package manager that is helpfully already installed.
All I had to do was add a new
-script entry under
steps:, and run the
choco install windows-sdk-10.1 --version=10.1.18362.1 command, to pick out the specific SDK I needed.
This script can be any PowerShell, so you could obviously use it to set up any other pre-requisites you need for your build. Here's my final
pool: vmImage: 'windows-latest' variables: solution: '**/*.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' steps: - script: choco install windows-sdk-10.1 --version=10.1.18362.1 - task: [email protected] - task: [email protected] inputs: restoreSolution: '$(solution)' - task: [email protected] inputs: solution: '$(solution)' platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' - task: [email protected] inputs: platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' testFiltercriteria: 'TestCategory!=IntegrationTest'