在 Azure Pipelines 中安装 Windows SDK 8.1 版本

Installing the Windows SDK 8.1 version in Azure Pipelines

我想将我的 Azure Pipeline vmImage 升级到 'windows-2019',以便使用 Visual Studio 2019 编译我的项目。

pool:
  vmImage: 'windows-2019'

variables:
  solution: '**/*.sln'
  buildConfiguration: 'Release'
  appxPackageDir: '$(build.artifactStagingDirectory)\AppxPackages\'

steps:
- task: VSBuild@1
  displayName: 'Build the project'
  inputs:
    solution: '$(solution)'
    configuration: '$(buildConfiguration)'
    msbuildArgs: '/p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="$(appxPackageDir)" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload'
- task: VSTest@2

但是,此图像中的 Windows SDK 8.1 seems not to be included。当我尝试编译我的 C++ 项目时:

##[error]C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VC\v150\Microsoft.Cpp.WindowsSDK.targets(46,5): Error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution".

如何在这个镜像中安装它?

相关:

我使用 choco 来获取 Windows 8.1 SDK:

- task: PowerShell@2
  displayName: 'Install the win 8.1 SDK'
  inputs:
    targetType: 'inline'
    script: |
      choco install windows-sdk-8.1