Virtual-environments: Add Windows SDK 8.1

Created on 7 May 2020  路  10Comments  路  Source: actions/virtual-environments

Tool information

Area for Triage:

Question, Bug, or Feature?:

Virtual environments affected

  • [ ] macOS 10.15
  • [ ] Ubuntu 16.04 LTS
  • [ ] Ubuntu 18.04 LTS
  • [ ] Windows Server 2016 R2
  • [x] Windows Server 2019

Can this tool be installed during the build?
Possibly, with admin rights and a restart.

Tool installation time in runtime

Are you willing to submit a PR?
Yes. It existed before: https://github.com/actions/virtual-environments/blob/master/images/win/scripts/Installers/Windows2016/Install-VS2017.ps1#L61

Windows feature request wontfix

Most helpful comment

@abergmeier Yep, specifically this should do:

- name: Install Windows 8.1 SDK
  shell: powershell
  run: |
    Invoke-WebRequest -Method Get -Uri https://go.microsoft.com/fwlink/p/?LinkId=323507 -OutFile sdksetup.exe -UseBasicParsing
    Start-Process -Wait sdksetup.exe -ArgumentList "/q", "/norestart", "/features", "OptionId.WindowsDesktopSoftwareDevelopmentKit", "OptionId.NetFxSoftwareDevelopmentKit"

All 10 comments

@jamesmcguirepro , Could you please share the approximate size of this SDK?

Also I see that Windows 8.1 SDK is officially deprecated in VS 2019.

The Windows 8.1 SDK is no longer available in the Visual Studio installer. Please upgrade your C++ projects to the latest Windows 10 SDK. If you have a hard dependency on 8.1, you can download it from the Windows SDK archive.

@maxim-lobanov
It's listed as 0.98 GB on my local machine's Uninstall Programs list

All SKUs of Windows 8.1 have left mainstream support. Only extended support is available for this version of Windows.

You can install just the desktop/.NET SDK features (no tooling) via:

sdksetup.exe /features OptionId.WindowsDesktopSoftwareDevelopmentKit OptionId.NetFxSoftwareDevelopmentKit /quiet

The SDK footprint is about 505MB, calculated from a clean machine install via:

  • C:\Program Files (x86)\Windows Kits\8.1 @ 490MB
  • C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A @ 15MB

Hi @jamesmcguirepro, considering that it can be installed on runtime and it's a pretty old version, we won't install it by default in the images. Thanks for the suggestion though.

So IIUC the steps for getting Windows SDK 8.1 on _windows-latest_ would be to:

  1. Download https://go.microsoft.com/fwlink/p/?LinkId=323507
  2. Run C:\temp\sdksetup.exe /features OptionId.WindowsDesktopSoftwareDevelopmentKit OptionId.NetFxSoftwareDevelopmentKit /quiet

@abergmeier Yep, specifically this should do:

- name: Install Windows 8.1 SDK
  shell: powershell
  run: |
    Invoke-WebRequest -Method Get -Uri https://go.microsoft.com/fwlink/p/?LinkId=323507 -OutFile sdksetup.exe -UseBasicParsing
    Start-Process -Wait sdksetup.exe -ArgumentList "/q", "/norestart", "/features", "OptionId.WindowsDesktopSoftwareDevelopmentKit", "OptionId.NetFxSoftwareDevelopmentKit"

That is what I tried I tried something similar and Invoke-WebRequest fails with:

Response status code does not indicate success: 301 (Moved Permanently).

because I did not bother to copy shell: powershell

The following also works for me:

    - name: Download and install Windows SDK
      run: |
        import subprocess
        import urllib.request
        urllib.request.urlretrieve("https://go.microsoft.com/fwlink/p/?LinkId=323507", "sdksetup.exe")
        subprocess.run(["sdksetup.exe", "/q", "/norestart", "/features", "OptionId.WindowsDesktopSoftwareDevelopmentKit", "OptionId.NetFxSoftwareDevelopmentKit"], check=True, capture_output=True)
      shell: python

If you use PowerShell Core, you'll run into questionable semantics around HTTP 3xx status codes (see PowerShell/PowerShell#4534), hence the shell: powershell instead 馃槈

NB: MS SDK 8.1 is the default SDK you get when you install Visual Studio 2015 SP3 (even on a Windows 10 machine), and VS2015 itself is supported until 2025. So maybe there is an argument for providing it until VS2015 goes out of support?

Or at least providing an action to install it when needed.

The powershell example above works, but after a quick download it takes several minutes to install. Does anyone have an action or workflow recipe for caching the actual installation (or even know if that's possible - not sure if there are registry aspects needed in addition to the files themselves)?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zackijack picture zackijack  路  3Comments

matthewfeickert picture matthewfeickert  路  3Comments

frankieroberto picture frankieroberto  路  4Comments

damccorm picture damccorm  路  3Comments

jayaddison picture jayaddison  路  3Comments