1# Locate the Windows SDK and add its binaries directory to PATH
2#
3# `toolname` can be overridden to use a different marker file.
4
5parameters:
6  toolname: signtool.exe
7
8steps:
9  - powershell: |
10      $kitroot = (gp 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots\').KitsRoot10
11      $tool = (gci -r "$kitroot\Bin\*\${{ parameters.toolname }}" | sort FullName -Desc | select -First 1)
12      if (-not $tool) {
13          throw "SDK is not available"
14      }
15      Write-Host "##vso[task.prependpath]$($tool.Directory)"
16      Write-Host "Adding $($tool.Directory) to PATH"
17    displayName: 'Add WinSDK tools to path'
18