From ab36398b98edaae7ca497ddc14c2d155f9e3f2c3 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 2 Jun 2026 10:43:23 -0700 Subject: [PATCH 1/4] Update GDK pipline for new layout NuGet packages --- .../pipelines/DirectXTK-GitHub-GDK-Dev17.yml | 19 ++- build/Directory.Build.props | 29 ++--- build/LogInfo.targets | 15 +++ build/RestoreGDK.proj | 2 +- build/RestoreGDK.ps1 | 79 +++++++----- build/SetupBWOI.cmd | 74 +++++++++++- build/SetupBWOI.targets | 113 +++++++++++++----- build/gdkedition.props | 1 + 8 files changed, 250 insertions(+), 82 deletions(-) create mode 100644 build/LogInfo.targets diff --git a/.azuredevops/pipelines/DirectXTK-GitHub-GDK-Dev17.yml b/.azuredevops/pipelines/DirectXTK-GitHub-GDK-Dev17.yml index a20210892..e2f655435 100644 --- a/.azuredevops/pipelines/DirectXTK-GitHub-GDK-Dev17.yml +++ b/.azuredevops/pipelines/DirectXTK-GitHub-GDK-Dev17.yml @@ -62,9 +62,7 @@ variables: jobs: - job: BUILD_GDK - displayName: 'Microsoft Game Development Kit (GDK)' - workspace: - clean: all + displayName: 'Microsoft Game Development Kit (Gaming.*.x64)' timeoutInMinutes: 120 cancelTimeoutInMinutes: 1 steps: @@ -100,7 +98,7 @@ jobs: - task: NuGetAuthenticate@1 displayName: 'NuGet Auth' - task: PowerShell@2 - displayName: 'NuGet Install GDK' + displayName: 'NuGet Install PC GDK' inputs: targetType: filePath filePath: ./build/RestoreGDK.ps1 @@ -118,6 +116,12 @@ jobs: solution: build/SetupBWOI.targets msbuildArchitecture: x64 msbuildArguments: /p:GDKEditionNumber=$(GDK_EDITION) + - task: MSBuild@1 + displayName: Log Information + inputs: + solution: build/LogInfo.targets + msbuildArchitecture: x64 + msbuildArguments: /p:GDKEditionNumber=$(GDK_EDITION) - task: VSBuild@1 displayName: Build solution DirectXTK_GDK_2022 pcdbg continueOnError: true @@ -147,6 +151,7 @@ jobs: - checkout: self clean: true fetchTags: false + fetchDepth: 1 - task: NuGetToolInstaller@1 displayName: 'Use NuGet' - task: PowerShell@2 @@ -200,6 +205,12 @@ jobs: echo ##vso[task.prependpath]%ADDBIN% failOnStderr: true + - task: MSBuild@1 + displayName: Log Information + inputs: + solution: build/LogInfo.targets + msbuildArchitecture: x64 + msbuildArguments: /p:GDKEditionNumber=$(GDK_EDITION) - task: CMake@1 displayName: 'CMake (MSVC): Config Debug' inputs: diff --git a/build/Directory.Build.props b/build/Directory.Build.props index abbd0c67c..3cbcef7f1 100644 --- a/build/Directory.Build.props +++ b/build/Directory.Build.props @@ -12,24 +12,11 @@ <_AlternativeVCTargetsPath170>$(ExtractedFolder)VCTargets170\ <_AlternativeVCTargetsPath160>$(ExtractedFolder)VCTargets160\ - <_AlternativeVCTargetsPath150 Condition="'$(GDKEditionNumber)' != '' AND '$(GDKEditionNumber)' < '241000'">$(ExtractedFolder)VCTargets150\ 15.0 - - <_PCNuGetPackage>Microsoft.PGDK - - - - <_PCNuGetPackage>Microsoft.GDK.PC - - - - <_PCNuGetPackage>$(_PCNuGetPackage).$(GDKEditionNumber) - - @@ -44,8 +31,19 @@ Project="$(ExtractedFolder)Microsoft.Windows.SDK.cpp.arm64\build\native\Microsoft.Windows.SDK.cpp.arm64.props" /> - + + + + + + + + true - $(_AlternativeVCTargetsPath150) $(_AlternativeVCTargetsPath160) $(_AlternativeVCTargetsPath170) diff --git a/build/LogInfo.targets b/build/LogInfo.targets new file mode 100644 index 000000000..80e73a706 --- /dev/null +++ b/build/LogInfo.targets @@ -0,0 +1,15 @@ + + + + + + + + + + + + diff --git a/build/RestoreGDK.proj b/build/RestoreGDK.proj index a87ad8b06..22de246d7 100644 --- a/build/RestoreGDK.proj +++ b/build/RestoreGDK.proj @@ -14,6 +14,6 @@ x64 - + diff --git a/build/RestoreGDK.ps1 b/build/RestoreGDK.ps1 index 9a012b5a2..8a3ee9548 100644 --- a/build/RestoreGDK.ps1 +++ b/build/RestoreGDK.ps1 @@ -1,7 +1,7 @@ <# .SYNOPSIS -Download and extract GDK NuGet based on edition number +Download and extract the 'base' GDK NuGet based on edition number, returning the full version number that can be used to restore other GDK packages in the set. .DESCRIPTION This script determines the NuGet package id to use based on the provided GDK edition number. It makes use of MSBuild PackageReference floating version numbers to do the restore operation. @@ -12,6 +12,12 @@ The GDK edition number in the form of YYMMQQ. .PARAMETER OutputDirectory Directory to write the packages into. Path should not already contain the packages. +.PARAMETER NewLayout +Switch to indicate to use the 'new layout' of GDK packages (October 2025 and later). + +.PARAMETER AutoLayout +Switch to indicate to automatically choose layout style based on edition number. + #> param( @@ -24,9 +30,15 @@ param( Mandatory, Position = 1 )] - [string]$OutputDirectory + [string]$OutputDirectory, + [switch]$NewLayout, + [switch]$AutoLayout ) +if ($NewLayout -and $AutoLayout) { + Write-Error "##[error]Cannot specify both NewLayout and AutoLayout switches" -ErrorAction Stop +} + # Validate output directory if ([string]::IsNullOrEmpty($OutputDirectory)) { Write-Error "##[error]Output Directory is required" -ErrorAction Stop @@ -65,23 +77,40 @@ if (-Not $nuget) { } # Determine NuGet package ID -if ($GDKEditionNumber -ge 241000) { - $PGDK_ID = "Microsoft.GDK.PC" +if ($GDKEditionNumber -lt 241000) { + Write-Error "##[error]Script supports October 2024 or later" -ErrorAction Stop +} + +if ($AutoLayout) { + if ($GDKEditionNumber -ge 251000) { + $NewLayout = $true + } + else { + $NewLayout = $false + } +} + +if ($NewLayout) { + if ($GDKEditionNumber -lt 251000) { + Write-Error "##[error]New layout only supported for October 2025 or later" -ErrorAction Stop + } + $GDK_ID = "Microsoft.GDK.Core" } else { - Write-Error "##[error]Script supports October 2024 or later" -ErrorAction Stop + $GDK_ID = "Microsoft.GDK.PC" } # Check that the package isn't already present -$PGDK_DIR = [IO.Path]::Combine($OutputDirectory, $PGDK_ID) -if (Test-Path $PGDK_DIR) { - Write-Error "##[error]PC Package ID already exists!" -ErrorAction Stop +$GDK_DIR = [IO.Path]::Combine($OutputDirectory, $GDK_ID) +if (Test-Path $GDK_DIR) { + Write-Error "##[error]NuGet Package ID already exists!" -ErrorAction Stop } # Restore Nuget packages using floating versions $propsfile = [IO.Path]::Combine( $PSScriptRoot , "gdkedition.props") $props = Get-Content -Path $propsfile $props = $props -replace '.+', ("{0}" -f $GDKEditionNumber) +$props = $props -replace '.+', ("{0}" -f $GDK_ID) Set-Content -Path $propsfile -Value $props $nugetArgs = "restore RestoreGDK.proj -PackageSaveMode nuspec -packagesDirectory `"{0}`"" -f $OutputDirectory.TrimEnd('\') @@ -92,35 +121,31 @@ if ($nugetrun.ExitCode -gt 0) { } # Verify expected output of restore -if (-Not (Test-Path $PGDK_DIR)) { - Write-Error "##[error]Missing PC package after restore!" -ErrorAction Stop +if (-Not (Test-Path $GDK_DIR)) { + Write-Error "##[error]Missing NuGet package after restore!" -ErrorAction Stop } # Reduce path depth removing version folder -$PGDK_VER = Get-ChildItem $PGDK_DIR -if ($PGDK_VER.Count -ne 1) { +$GDK_VER = Get-ChildItem $GDK_DIR +if ($GDK_VER.Count -ne 1) { Write-Error "##[error]Expected a single directory for the version!" -ErrorAction Stop } -$content = Get-ChildItem $PGDK_VER.Fullname -ForEach-Object -InputObject $content { Move-Item $_.Fullname -Destination $PGDK_DIR } -Remove-Item $PGDK_VER.Fullname - -Write-Host ("##[debug]PC Package ID: {0} Version: {1}" -f $PGDK_ID, $PGDK_VER) +$content = Get-ChildItem $GDK_VER.Fullname +ForEach-Object -InputObject $content { Move-Item $_.Fullname -Destination $GDK_DIR } +Remove-Item $GDK_VER.Fullname +Write-Host ("##[debug]NuGet Package ID: {0} Version: {1}" -f $GDK_ID, $GDK_VER) # Read the nuspec files -$PGDK_NUSPEC = New-Object xml -$PGDK_NUSPEC.PreserveWhitespace = $true -$PGDK_NUSPEC.Load([IO.Path]::Combine($PGDK_DIR, $PGDK_ID + ".nuspec")) +$GDK_NUSPEC = New-Object xml +$GDK_NUSPEC.PreserveWhitespace = $true +$GDK_NUSPEC.Load([IO.Path]::Combine($GDK_DIR, $GDK_ID + ".nuspec")) # Log results -Write-Host "##[group]PC Nuget Package nuspec" -Write-host $PGDK_NUSPEC.outerxml +Write-Host "##[group]NuGet Nuget Package nuspec" +Write-host $GDK_NUSPEC.outerxml Write-Host "##[endgroup]" -$id = $PGDK_NUSPEC.package.metadata.id -Write-Host "##vso[task.setvariable variable=PCNuGetPackage;]$id" - -$ver = $PGDK_NUSPEC.package.metadata.version -Write-Host "##vso[task.setvariable variable=PCNuGetPackageVersion;]$ver" +$ver = $GDK_NUSPEC.package.metadata.version +Write-Host "##vso[task.setvariable variable=GDKNuGetPackageVersion;]$ver" diff --git a/build/SetupBWOI.cmd b/build/SetupBWOI.cmd index f50ef7ed2..8c8c9f878 100644 --- a/build/SetupBWOI.cmd +++ b/build/SetupBWOI.cmd @@ -13,9 +13,73 @@ goto needconsole set GXDKEDITION=%2 echo GXDKEDITION: %GXDKEDITION% +set CORENUGET=%1\Microsoft.GDK.Core\ +if EXIST %CORENUGET% goto newlayout + set PCNUGET=%1\Microsoft.GDK.PC\ -if NOT EXIST %PCNUGET% goto missingpcnuget +if EXIST %PCNUGET% goto oldlayout + +goto missingpcnuget + +REM Use new layouts (October 2025 GDK and later) +:newlayout + +set GameDK=%CORENUGET%native\bin\ + +if %3.==PC. goto newlayoutpc +if %3.==XboxOne. goto newlayoutxboxone +if %3.==Scarlett. goto newlayoutscarlett +goto needconsole + +:newlayoutpc +set WINDOWSNUGET=%1\Microsoft.GDK.Windows\ +if NOT EXIST %WINDOWSNUGET% goto missingpcnuget + +set GameDKCoreLatest=%WINDOWSNUGET%native\%GXDKEDITION%\ + +set ADDINCLUDE=%GameDKCoreLatest%windows\include +REM arm64? +set ADDBIN=%GameDKCoreLatest%windows\bin\x64;%CORENUGET%native\bin +set ADDLIB=%GameDKCoreLatest%windows\lib\x64 +goto continuenew + +:newlayoutxboxone +set XBOXNUGET=%1\Microsoft.GDK.Xbox.XboxOne\ +if NOT EXIST %XBOXNUGET% goto missingxboxnuget + +set GameDKXboxLatest=%XBOXNUGET%native\%GXDKEDITION%\ + +set ADDINCLUDE=%GameDKXboxLatest%xbox\include\gen8;%GameDKXboxLatest%xbox\include +set ADDBIN=%GameDKXboxLatest%xbox\bin\gen8;%GameDKXboxLatest%xbox\bin\x64;%CORENUGET%native\bin +set ADDLIB=%GameDKXboxLatest%xbox\lib\gen8;%GameDKXboxLatest%xbox\lib\x64 +goto continuenew + +:newlayoutscarlett +set XBOXNUGET=%1\Microsoft.GDK.Xbox.XboxSeriesX_S\ +if NOT EXIST %XBOXNUGET% goto missingxboxnuget + +set GameDKXboxLatest=%XBOXNUGET%native\%GXDKEDITION%\ + +set ADDINCLUDE=%GameDKXboxLatest%xbox\include\gen9;%GameDKXboxLatest%xbox\include +set ADDBIN=%GameDKXboxLatest%xbox\bin\gen9;%GameDKXboxLatest%xbox\bin\x64;%CORENUGET%native\bin +set ADDLIB=%GameDKXboxLatest%xbox\lib\gen9;%GameDKXboxLatest%xbox\lib\x64 +goto continuenew + +:continuenew +echo GameDK: %GameDK% +echo GameDKCoreLatest: %GameDKCoreLatest% +echo GameDKXboxLatest: %GameDKXboxLatest% +echo ADDBIN: %ADDBIN% +echo ADDINCLUDE: %ADDINCLUDE% +echo ADDLIB: %ADDLIB% + +set PATH=%ADDBIN%;%PATH% +set INCLUDE=%INCLUDE%;%ADDINCLUDE% +set LIB=%LIB%;%ADDLIB% +exit /b 0 +REM Use old layouts (pre-October 2025 GDK) +:oldlayout set GRDKLatest=%PCNUGET%native\%GXDKEDITION%\GRDK\ echo GRDKLatest: %GRDKLatest% @@ -33,7 +97,7 @@ set GameDKLatest=%XBOXNUGET%native\%GXDKEDITION%\ set ADDBIN=%GXDKLatest%bin\%3;%PCNUGET%native\bin;%XBOXNUGET%native\bin set ADDINCLUDE=%GXDKLatest%gamekit\include\%3;%GXDKLatest%gamekit\include;%GRDKLatest%gamekit\include set ADDLIB=%GXDKLatest%gamekit\lib\amd64\%3;%GXDKLatest%gamekit\lib\amd64;%GRDKLatest%gamekit\lib\amd64 -goto continue +goto continueold :grdkonly set GameDK=%PCNUGET%native\ @@ -43,7 +107,7 @@ set ADDBIN=%PCNUGET%native\bin set ADDINCLUDE=%GRDKLatest%gamekit\include set ADDLIB=%GRDKLatest%gamekit\lib\amd64 -:continue +:continueold echo GameDK: %GameDK% echo GameDKLatest: %GameDKLatest% echo ADDBIN: %ADDBIN% @@ -68,9 +132,9 @@ echo Usage: This script requires the target type of PC, Scarlett, or XboxOne in exit /b 1 :missingpcnuget -echo ERROR - Cannot find Microsoft.GDK.PC installed at '%1' +echo ERROR - Cannot find Microsoft.GDK.Core/Windows/PC installed at '%1' exit /b 1 :missingxboxnuget -echo ERROR - Cannot find Microsoft.GDK.Xbox installed at '%1' +echo ERROR - Cannot find Microsoft.GDK.Xbox/.XboxOne/.XboxSeriesX_S installed at '%1' exit /b 1 diff --git a/build/SetupBWOI.targets b/build/SetupBWOI.targets index 9ad9e9023..470a3b935 100644 --- a/build/SetupBWOI.targets +++ b/build/SetupBWOI.targets @@ -7,22 +7,11 @@ --> + 999999 C:\xtracted\ $(ExtractedFolder)\ - - <_PCNuGetPackage>Microsoft.PGDK - - - - <_PCNuGetPackage>Microsoft.GDK.PC - - - - <_PCNuGetPackage>$(_PCNuGetPackage).$(GDKEditionNumber) - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + - - + + + + - - + + + + + + + + + + + + <_VSFolder Condition="'$(VisualStudioVersion)' == '18.0'">VS2026 + <_VSFolder Condition="'$(VisualStudioVersion)' == '17.0'">VS2022 + + + @@ -119,9 +159,13 @@ SixtyFourBit = (IntPtr.Size == 8) ? true : false; - + + + + @@ -131,13 +175,24 @@ SixtyFourBit = (IntPtr.Size == 8) ? true : false; - + + + + - + + + ;_CreateVCTargetsFolder + ;_CreateVCTargetsFolderOld + + + + diff --git a/build/gdkedition.props b/build/gdkedition.props index 36ae93594..6e7a69dc9 100644 --- a/build/gdkedition.props +++ b/build/gdkedition.props @@ -2,5 +2,6 @@ 000000 + Microsoft.GDK.xyz From d73feb16e091f20770f40059e660a7aaa7fc216e Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 2 Jun 2026 11:43:51 -0700 Subject: [PATCH 2/4] Update for Gaming.Desktop.x64 deprecation --- .azuredevops/pipelines/DirectXTK-GitHub-GDK-Dev17.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.azuredevops/pipelines/DirectXTK-GitHub-GDK-Dev17.yml b/.azuredevops/pipelines/DirectXTK-GitHub-GDK-Dev17.yml index e2f655435..59a1c89c7 100644 --- a/.azuredevops/pipelines/DirectXTK-GitHub-GDK-Dev17.yml +++ b/.azuredevops/pipelines/DirectXTK-GitHub-GDK-Dev17.yml @@ -104,6 +104,12 @@ jobs: filePath: ./build/RestoreGDK.ps1 arguments: -GDKEditionNumber $(GDK_EDITION) -OutputDirectory $(EXTRACTED_FOLDER) failOnStderr: true + - task: NuGetCommand@2 + displayName: 'NuGet install Xbox GDK' + # Required for Gaming.Desktop.x64 MSBuild rules which are deprecated and only ship in the GXDK + inputs: + command: custom + arguments: 'install -directdownload Microsoft.GDK.Xbox -ExcludeVersion -Version $(GDKNuGetPackageVersion) -OutputDirectory $(EXTRACTED_FOLDER)' - task: CopyFiles@2 displayName: Set up Directory.Build.props inputs: From 6f5d92c7c0b8b6815c0dd43941e61e713e2ca8dd Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 2 Jun 2026 12:00:26 -0700 Subject: [PATCH 3/4] Update GHA --- .github/workflows/codeql.yml | 6 +++--- .github/workflows/msvc.yml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 92b289a29..085774f5f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -41,7 +41,7 @@ permissions: jobs: analyze: name: Analyze (${{ matrix.language }}) - runs-on: windows-latest + runs-on: windows-2022 timeout-minutes: 360 permissions: actions: read # for github/codeql-action/init to get workflow details @@ -65,7 +65,7 @@ jobs: - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 - name: Initialize CodeQL - uses: github/codeql-action/init@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v3.29.5 + uses: github/codeql-action/init@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0 with: languages: ${{ matrix.language }} build-mode: manual @@ -86,6 +86,6 @@ jobs: run: msbuild MakeSpriteFont.csproj /p:Configuration=Debug /p:Platform=AnyCPU - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v3.29.5 + uses: github/codeql-action/analyze@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0 with: category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index 3e7805537..9b1c73092 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -45,7 +45,7 @@ jobs: security-events: write actions: read name: Analyze - runs-on: windows-latest + runs-on: windows-2022 steps: - name: Checkout repository @@ -76,6 +76,6 @@ jobs: # Upload SARIF file to GitHub Code Scanning Alerts - name: Upload SARIF to GitHub - uses: github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v3.29.5 + uses: github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0 with: sarif_file: ${{ steps.run-analysis.outputs.sarif }} From 396e131e1a90584fc15f66e7b1f5f0c37df65d6f Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 2 Jun 2026 12:07:02 -0700 Subject: [PATCH 4/4] only doing analysis on desktop not uwp codepaths --- .github/workflows/codeql.yml | 2 +- .github/workflows/msvc.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 085774f5f..f9885da0d 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -41,7 +41,7 @@ permissions: jobs: analyze: name: Analyze (${{ matrix.language }}) - runs-on: windows-2022 + runs-on: windows-latest timeout-minutes: 360 permissions: actions: read # for github/codeql-action/init to get workflow details diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index 9b1c73092..5aaf51d42 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -45,7 +45,7 @@ jobs: security-events: write actions: read name: Analyze - runs-on: windows-2022 + runs-on: windows-latest steps: - name: Checkout repository