From e1ee6fb94467c98f5f3eda8837d3f8232922ff5a Mon Sep 17 00:00:00 2001 From: 5an7y Date: Thu, 16 Jul 2026 08:43:29 -0700 Subject: [PATCH 1/3] Add UpdateNuGet.ps1 to bump WDK/SDK NuGet package version Adds a small PowerShell helper that updates the Windows WDK and SDK NuGet package version referenced by Directory.Build.props and packages.config in one command, e.g. '.\UpdateNuGet --package 10.0.28000.2525' or '--package 10.0.28000.2525-preview'. Only Microsoft.Windows.WDK*/SDK* references are changed; other packages, file encoding (BOM) and line endings are preserved. Supports --whatif and version validation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c65df05b-3bb0-438a-a7ed-be9cf0e7781b --- UpdateNuGet.ps1 | 152 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 UpdateNuGet.ps1 diff --git a/UpdateNuGet.ps1 b/UpdateNuGet.ps1 new file mode 100644 index 000000000..f4582e6d8 --- /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 [--whatif] + + --package, -p 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 ." +} + +# 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.\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' + # + Pattern = [regex]'( {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 +} From 344396d1998348c0281c753d64ce3b875bfcff56 Mon Sep 17 00:00:00 2001 From: 5an7y Date: Thu, 16 Jul 2026 08:43:29 -0700 Subject: [PATCH 2/3] Bump WDK/SDK NuGet packages to 10.0.28000.2525 Updates Directory.Build.props and packages.config to reference the Windows WDK and SDK NuGet packages at version 10.0.28000.2525 (from 10.0.28000.1839), applied via UpdateNuGet.ps1. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 459e95c0-2b52-44b3-a129-79a7f202dd0a --- Directory.Build.props | 10 +++++----- packages.config | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 11951aed3..9ed3a1810 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/packages.config b/packages.config index d2a0bc5c0..759445368 100644 --- a/packages.config +++ b/packages.config @@ -1,8 +1,8 @@  - - - - - + + + + + From 2164a2171e12c03ee5c32eb208adc740b4f18b1b Mon Sep 17 00:00:00 2001 From: 5an7y Date: Thu, 16 Jul 2026 12:01:54 -0700 Subject: [PATCH 3/3] Bump WDK/SDK NuGet packages to 10.0.28000.2526 Updates Directory.Build.props and packages.config to reference the Windows WDK and SDK NuGet packages at version 10.0.28000.2526 (from 10.0.28000.2525), applied via UpdateNuGet.ps1. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 34851cee-f112-458d-a93c-e92472cb7525 --- Directory.Build.props | 10 +++++----- packages.config | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 9ed3a1810..583b7f110 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/packages.config b/packages.config index 759445368..4516da4ce 100644 --- a/packages.config +++ b/packages.config @@ -1,8 +1,8 @@  - - - - - + + + + +