summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprashantchahar <[email protected]>2026-07-27 13:34:34 -0700
committerGitHub <[email protected]>2026-07-27 13:34:34 -0700
commitef7c3074748ab05726c3a9161d3256118efd76e2 (patch)
tree9c1d97fef3e436a45e485a9d65d34ba22a24f8e3
parent2ee527bfeb0aeb6be11f0a8b6dce4011b358ce89 (diff)
parent2164a2171e12c03ee5c32eb208adc740b4f18b1b (diff)
Merge pull request #1403 from microsoft/user/jvalesmena/WDK-2607
Bump WDK/SDK NuGet packages to 10.0.28000.2526
-rw-r--r--Directory.Build.props10
-rw-r--r--UpdateNuGet.ps1152
-rw-r--r--packages.config10
3 files changed, 162 insertions, 10 deletions
diff --git a/Directory.Build.props b/Directory.Build.props
index 11951aed..583b7f11 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,7 +1,7 @@
<Project>
-<Import Project="packages\Microsoft.Windows.WDK.x64.10.0.28000.1839\build\native\Microsoft.Windows.WDK.x64.props" Condition="Exists('packages\Microsoft.Windows.WDK.x64.10.0.28000.1839\build\native\Microsoft.Windows.WDK.x64.props') and '$(Platform)' == 'x64'"/>
-<Import Project="packages\Microsoft.Windows.WDK.arm64.10.0.28000.1839\build\native\Microsoft.Windows.WDK.arm64.props" Condition="Exists('packages\Microsoft.Windows.WDK.arm64.10.0.28000.1839\build\native\Microsoft.Windows.WDK.arm64.props') and '$(Platform)' == 'ARM64'"/>
-<Import Project="packages\Microsoft.Windows.SDK.CPP.x64.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.x64.props" Condition="Exists('packages\Microsoft.Windows.SDK.CPP.x64.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.x64.props') and '$(Platform)' == 'x64'"/>
-<Import Project="packages\Microsoft.Windows.SDK.CPP.arm64.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.arm64.props" Condition="Exists('packages\Microsoft.Windows.SDK.CPP.arm64.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.arm64.props') and '$(Platform)' == 'ARM64'"/>
-<Import Project="packages\Microsoft.Windows.SDK.CPP.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.props" Condition="Exists('packages\Microsoft.Windows.SDK.CPP.10.0.28000.1839\build\native\Microsoft.Windows.SDK.cpp.props')"/>
+<Import Project="packages\Microsoft.Windows.WDK.x64.10.0.28000.2526\build\native\Microsoft.Windows.WDK.x64.props" Condition="Exists('packages\Microsoft.Windows.WDK.x64.10.0.28000.2526\build\native\Microsoft.Windows.WDK.x64.props') and '$(Platform)' == 'x64'"/>
+<Import Project="packages\Microsoft.Windows.WDK.arm64.10.0.28000.2526\build\native\Microsoft.Windows.WDK.arm64.props" Condition="Exists('packages\Microsoft.Windows.WDK.arm64.10.0.28000.2526\build\native\Microsoft.Windows.WDK.arm64.props') and '$(Platform)' == 'ARM64'"/>
+<Import Project="packages\Microsoft.Windows.SDK.CPP.x64.10.0.28000.2526\build\native\Microsoft.Windows.SDK.cpp.x64.props" Condition="Exists('packages\Microsoft.Windows.SDK.CPP.x64.10.0.28000.2526\build\native\Microsoft.Windows.SDK.cpp.x64.props') and '$(Platform)' == 'x64'"/>
+<Import Project="packages\Microsoft.Windows.SDK.CPP.arm64.10.0.28000.2526\build\native\Microsoft.Windows.SDK.cpp.arm64.props" Condition="Exists('packages\Microsoft.Windows.SDK.CPP.arm64.10.0.28000.2526\build\native\Microsoft.Windows.SDK.cpp.arm64.props') and '$(Platform)' == 'ARM64'"/>
+<Import Project="packages\Microsoft.Windows.SDK.CPP.10.0.28000.2526\build\native\Microsoft.Windows.SDK.cpp.props" Condition="Exists('packages\Microsoft.Windows.SDK.CPP.10.0.28000.2526\build\native\Microsoft.Windows.SDK.cpp.props')"/>
</Project>
diff --git a/UpdateNuGet.ps1 b/UpdateNuGet.ps1
new file mode 100644
index 00000000..f4582e6d
--- /dev/null
+++ b/UpdateNuGet.ps1
@@ -0,0 +1,152 @@
+#Requires -Version 5.1
+<#
+.SYNOPSIS
+ Updates the Windows WDK and SDK NuGet package version referenced by
+ Directory.Build.props and packages.config.
+
+.DESCRIPTION
+ Rewrites the WDK/SDK NuGet version in both repo-root files so the whole
+ sample tree can be moved to a new WDK/SDK build with a single command.
+
+ Only packages whose id starts with 'Microsoft.Windows.WDK' or
+ 'Microsoft.Windows.SDK' are touched. Any other package reference (for
+ example Microsoft.Windows.ImplementationLibrary) is left untouched.
+
+ The files' existing encoding (BOM / no BOM) and line endings are preserved.
+
+.EXAMPLE
+ .\UpdateNuGet --package 10.0.28000.2525
+
+.EXAMPLE
+ .\UpdateNuGet --package 10.0.28000.2525-preview
+
+.EXAMPLE
+ .\UpdateNuGet --package 10.0.28000.2525 --whatif
+#>
+
+Set-StrictMode -Version Latest
+$ErrorActionPreference = 'Stop'
+
+function Show-Usage {
+ @'
+Usage: .\UpdateNuGet --package <version> [--whatif]
+
+ --package, -p <version> New WDK/SDK NuGet version. Examples:
+ 10.0.28000.2525
+ 10.0.28000.2525-preview
+ --whatif Show what would change without writing any file.
+ --help, -h Show this help.
+'@ | Write-Host
+}
+
+# --- parse arguments ---------------------------------------------------------
+$NewVersion = $null
+$WhatIf = $false
+
+for ($i = 0; $i -lt $args.Count; $i++) {
+ $a = [string]$args[$i]
+ if ($a -match '^(?:--package|-package|-p)=(.+)$') {
+ $NewVersion = $Matches[1]
+ }
+ elseif ($a -match '^(?:--package|-package|-p)$') {
+ $i++
+ if ($i -lt $args.Count) { $NewVersion = [string]$args[$i] }
+ else { throw "Missing value after '$a'." }
+ }
+ elseif ($a -match '^(?:--whatif|-whatif|-WhatIf)$') {
+ $WhatIf = $true
+ }
+ elseif ($a -match '^(?:--help|-help|-h|-\?|/\?)$') {
+ Show-Usage
+ return
+ }
+ elseif ($a -notmatch '^-' -and -not $NewVersion) {
+ $NewVersion = $a
+ }
+ else {
+ Show-Usage
+ throw "Unknown or unexpected argument: '$a'."
+ }
+}
+
+if (-not $NewVersion) {
+ Show-Usage
+ throw "No version supplied. Pass --package <version>."
+}
+
+# Allow a leading 'v' (v10.0.28000.2525) for convenience.
+$NewVersion = $NewVersion.TrimStart('v', 'V')
+
+if ($NewVersion -notmatch '^\d+\.\d+\.\d+\.\d+(?:-[0-9A-Za-z.\-]+)?$') {
+ throw "Version '$NewVersion' does not look like a NuGet version " +
+ "(expected e.g. 10.0.28000.2525 or 10.0.28000.2525-preview)."
+}
+
+# --- files to update ---------------------------------------------------------
+$root = if ($PSScriptRoot) { $PSScriptRoot } else { (Get-Location).Path }
+
+$targets = @(
+ [pscustomobject]@{
+ Path = Join-Path $root 'Directory.Build.props'
+ # packages\Microsoft.Windows.WDK.x64.<version>\build\native\...
+ Pattern = [regex]'(Microsoft\.Windows\.(?:WDK|SDK)(?:\.CPP)?(?:\.(?:x64|x86|arm64|arm))?\.)(\d[0-9A-Za-z.\-]*?)(\\build\\native\\)'
+ },
+ [pscustomobject]@{
+ Path = Join-Path $root 'packages.config'
+ # <package id="Microsoft.Windows.WDK.x64" version="<version>" ... />
+ Pattern = [regex]'(<package id="Microsoft\.Windows\.(?:WDK|SDK)[^"]*" version=")([^"]*)(")'
+ }
+)
+
+$replacement = '${1}' + $NewVersion + '${3}'
+$anyChange = $false
+
+Write-Host "Updating WDK/SDK NuGet packages to $NewVersion" -ForegroundColor Cyan
+Write-Host ""
+
+foreach ($t in $targets) {
+ $name = [System.IO.Path]::GetFileName($t.Path)
+
+ if (-not (Test-Path -LiteralPath $t.Path)) {
+ Write-Warning "Skipping (not found): $($t.Path)"
+ continue
+ }
+
+ $bytes = [System.IO.File]::ReadAllBytes($t.Path)
+ $hasBom = ($bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF)
+ $text = [System.IO.File]::ReadAllText($t.Path)
+
+ $found = $t.Pattern.Matches($text)
+ if ($found.Count -eq 0) {
+ Write-Warning "No WDK/SDK package references found in $name."
+ continue
+ }
+
+ $oldVersions = $found | ForEach-Object { $_.Groups[2].Value } | Sort-Object -Unique
+ $newText = $t.Pattern.Replace($text, $replacement)
+
+ if ($newText -ceq $text) {
+ Write-Host (" {0,-22} already at {1} ({2} reference(s))" -f $name, ($oldVersions -join ', '), $found.Count)
+ continue
+ }
+
+ Write-Host (" {0,-22} {1} -> {2} ({3} reference(s))" -f $name, ($oldVersions -join ', '), $NewVersion, $found.Count)
+
+ if (-not $WhatIf) {
+ $enc = New-Object System.Text.UTF8Encoding($hasBom)
+ [System.IO.File]::WriteAllText($t.Path, $newText, $enc)
+ }
+ $anyChange = $true
+}
+
+Write-Host ""
+if ($WhatIf) {
+ Write-Host "WhatIf: no files were modified." -ForegroundColor Yellow
+}
+elseif ($anyChange) {
+ Write-Host "Done. WDK/SDK packages set to $NewVersion." -ForegroundColor Green
+ Write-Host "Next: restore packages (e.g. 'nuget restore' or 'msbuild -t:restore')."
+}
+else {
+ Write-Host "No changes were necessary." -ForegroundColor Green
+}
diff --git a/packages.config b/packages.config
index d2a0bc5c..4516da4c 100644
--- a/packages.config
+++ b/packages.config
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.Windows.SDK.CPP" version="10.0.28000.1839" targetFramework="native" />
- <package id="Microsoft.Windows.SDK.CPP.x64" version="10.0.28000.1839" targetFramework="native" />
- <package id="Microsoft.Windows.SDK.CPP.arm64" version="10.0.28000.1839" targetFramework="native" />
- <package id="Microsoft.Windows.WDK.x64" version="10.0.28000.1839" targetFramework="native" />
- <package id="Microsoft.Windows.WDK.arm64" version="10.0.28000.1839" targetFramework="native" />
+ <package id="Microsoft.Windows.SDK.CPP" version="10.0.28000.2526" targetFramework="native" />
+ <package id="Microsoft.Windows.SDK.CPP.x64" version="10.0.28000.2526" targetFramework="native" />
+ <package id="Microsoft.Windows.SDK.CPP.arm64" version="10.0.28000.2526" targetFramework="native" />
+ <package id="Microsoft.Windows.WDK.x64" version="10.0.28000.2526" targetFramework="native" />
+ <package id="Microsoft.Windows.WDK.arm64" version="10.0.28000.2526" targetFramework="native" />
</packages>