From f2c2b3db283f3cda75e8e2967d3825cc018e8b88 Mon Sep 17 00:00:00 2001 From: Arlo Date: Mon, 2 Feb 2026 17:03:47 -0600 Subject: [PATCH] ci: update .NET SDK to 9.0.310 and use global.json for version control - Update SDK version from 9.0.308 to 9.0.310 in global.json - Reorder workflow steps: checkout before setup-dotnet - Use global-json-file input for jobs with checkout - Maintain DOTNET_VERSION env var for artifact-only jobs (no checkout) This eliminates version duplication and prevents future drift between global.json and workflow definitions. Related to PR #826 which disabled rollForward to prevent SDK version mismatches. --- .github/workflows/build.yml | 61 +++++++++++++++++++------------------ global.json | 4 +-- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cf2369852..4c632fbfc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,8 @@ on: merge_group: env: - DOTNET_VERSION: ${{ '9.0.x' }} + DOTNET_VERSION: '9.0.310' # Only used by jobs that cannot access global.json (no checkout/artifact-only jobs) + ENABLE_DIAGNOSTICS: true #COREHOST_TRACE: 1 MSBUILD_VERBOSITY: normal @@ -40,11 +41,6 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - - name: Install .NET SDK v${{ env.DOTNET_VERSION }} - uses: actions/setup-dotnet@v4 - with: - dotnet-version: ${{ env.DOTNET_VERSION }} - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Checkout Repository uses: actions/checkout@v4 @@ -54,6 +50,11 @@ jobs: fetch-depth: 0 fetch-tags: true + - name: Install .NET SDK + uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + # Restore Tools from Manifest list in the Repository - name: Restore dotnet tools run: dotnet tool restore @@ -145,11 +146,11 @@ jobs: Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpCount' -Type DWord -Value '10' Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpType' -Type DWord -Value '2' - - name: Install .NET SDK v${{ env.DOTNET_VERSION }} + - name: Install .NET SDK if: ${{ env.ENABLE_DIAGNOSTICS == 'true' && env.HAS_BUILDABLE_COMPONENTS == 'true' }} uses: actions/setup-dotnet@v4 with: - dotnet-version: ${{ env.DOTNET_VERSION }} + global-json-file: global.json - name: .NET Info (if diagnostics) if: ${{ env.ENABLE_DIAGNOSTICS == 'true' && env.HAS_BUILDABLE_COMPONENTS == 'true' }} @@ -270,15 +271,6 @@ jobs: VERSION_PROPERTY: ${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/rel/') || startsWith(github.ref, 'refs/tags/release/')) && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }} steps: - - name: Install .NET SDK v${{ env.DOTNET_VERSION }} - uses: actions/setup-dotnet@v4 - with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - - name: .NET Info (if diagnostics) - if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} - run: dotnet --info - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Checkout Repository uses: actions/checkout@v4 @@ -287,7 +279,16 @@ jobs: ref: ${{ github.sha }} fetch-depth: 0 fetch-tags: true - + + - name: Install .NET SDK + uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + + - name: .NET Info (if diagnostics) + if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} + run: dotnet --info + - name: Format Date/Time for Package Version (Tag builds only) if: ${{ startsWith(github.ref, 'refs/tags/') }} run: | @@ -396,7 +397,7 @@ jobs: winui: [0, 2, 3] steps: - - name: Install .NET SDK v${{ env.DOTNET_VERSION }} + - name: Install .NET SDK uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ env.DOTNET_VERSION }} @@ -461,7 +462,7 @@ jobs: winui: [0, 2, 3] steps: - - name: Install .NET SDK v${{ env.DOTNET_VERSION }} + - name: Install .NET SDK uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ env.DOTNET_VERSION }} @@ -486,15 +487,6 @@ jobs: HEADS_DIRECTORY: tooling/ProjectHeads steps: - - name: Install .NET SDK v${{ env.DOTNET_VERSION }} - uses: actions/setup-dotnet@v4 - with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - - name: .NET Info (if diagnostics) - if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} - run: dotnet --info - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Checkout Repository uses: actions/checkout@v4 @@ -504,6 +496,15 @@ jobs: fetch-depth: 0 fetch-tags: true + - name: Install .NET SDK + uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + + - name: .NET Info (if diagnostics) + if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} + run: dotnet --info + # Restore Tools from Manifest list in the Repository - name: Restore dotnet tools run: dotnet tool restore @@ -530,3 +531,5 @@ jobs: with: name: linux-logs path: ./**/*.*log + + diff --git a/global.json b/global.json index 27a187755..338ca727d 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "9.0.101", + "version": "9.0.310", "rollForward": "latestFeature" }, - "msbuild-sdks": + "msbuild-sdks": { "MSBuild.Sdk.Extras":"3.0.23" }