Skip to content

Build tools install several SDK versions and keep every one

The SDKs, MSBuild, the Package Cache and vcpkg. What a developer machine accumulates outside the IDE.

5 min read

Even without the full IDE, a Windows development machine accumulates SDKs and build tools, and each version installs beside the last rather than replacing it.

Where they are

Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin','C:\Program Files (x86)\Windows Kits\10\Include' -EA SilentlyContinue |
  Select-Object Name
Get-ChildItem 'C:\Program Files (x86)\Microsoft Visual Studio\*\BuildTools' -EA SilentlyContinue |
  ForEach-Object {
    $s = (Get-ChildItem $_.FullName -Recurse -Force -File -EA SilentlyContinue | Measure-Object Length -Sum).Sum
    '{0,8:N0} MB  {1}' -f ($s/1MB), $_.FullName
  }

Each folder under Windows Kits\10\bin is an SDK version. A machine that has built against a few Windows releases has several, and only the ones your projects target are needed.

Removing them properly

SDKs appear in Settings, Apps as their own entries and uninstall from there. The Visual Studio Installer also manages them when they were installed as part of a workload, which is the tidier route on a machine that has the IDE.

vcpkg, which grows without limit

Get-ChildItem "$env:USERPROFILE\AppData\Local\vcpkg","C:\vcpkg\installed","C:\vcpkg\buildtrees","C:\vcpkg\packages" -EA SilentlyContinue |
  ForEach-Object {
    $s = (Get-ChildItem $_.FullName -Recurse -Force -File -EA SilentlyContinue | Measure-Object Length -Sum).Sum
    '{0,8:N0} MB  {1}' -f ($s/1MB), $_.FullName
  }

buildtrees is the one that surprises people: it holds the full source and intermediate objects for every port built, and it is safe to remove entirely. vcpkg remove --outdated and clearing buildtrees are the two commands worth knowing.

The Package Cache next door

C:\ProgramData\Package Cache holds installer packages for everything installed by the Visual Studio family of installers, kept for repair and modify. It measured 1,668 MB on the machine above. It is the same kind of folder as the Windows Installer cache and the same rule applies: do not delete it by hand.

Common questions

Where is the Windows SDK installed?

Under C:\Program Files (x86)\Windows Kits\10, with a folder per version in bin and Include. Each version installs beside the last rather than replacing it.

Can I remove old Windows SDK versions?

Yes, through Settings, Apps where each appears as its own entry, or through the Visual Studio Installer if they came with a workload. Keep the versions your projects target.

What is the vcpkg buildtrees folder?

Full source and intermediate build output for every port you have built. It is safe to remove entirely and is usually the largest part of a vcpkg installation.

What is C:\ProgramData\Package Cache?

Installer packages kept by the Visual Studio family of installers so software can be repaired or modified later. Like the Windows Installer folder, it should not be deleted by hand.

Read next