From 9b5639e6db092a21100792ef4f8ae17a34b8d09d Mon Sep 17 00:00:00 2001 From: Gavin Barron Date: Thu, 12 Nov 2026 13:16:30 -0800 Subject: [PATCH] build(frameworks)!: align .NET target frameworks with support lifecycles Replace the dedicated net8.0 target with net11.0 while preserving other library targets. Update SDK selection, CI, coverage, trimming validation, and documentation. BREAKING CHANGE: .NET target framework alignment with .NET support lifecycles. The dedicated net8.0 library and test targets are removed and net11.0 is added. Building requires the .NET 11 SDK. Retained .NET Standard assets may still provide compatible fallbacks for .NET 8 consumers. Refs #1143 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .azure-pipelines/daily-ci-build.yml | 8 ++++---- .github/workflows/sonarcloud.yml | 6 +++--- .github/workflows/validatePullRequest.yml | 12 ++++++------ CONTRIBUTING.md | 12 ++++++++++++ README.md | 2 +- global.json | 2 +- pipelines/productionBuild.yml | 8 ++++---- src/Microsoft.Graph.Core/Microsoft.Graph.Core.csproj | 2 +- src/Microsoft.Graph.Core/global.json | 2 +- .../Microsoft.Graph.DotnetCore.Core.Test.csproj | 2 +- .../Microsoft.Graph.DotnetCore.Core.Trimming.csproj | 2 +- .../global.json | 2 +- 12 files changed, 36 insertions(+), 24 deletions(-) diff --git a/.azure-pipelines/daily-ci-build.yml b/.azure-pipelines/daily-ci-build.yml index df0ea56a5..58a3c2353 100644 --- a/.azure-pipelines/daily-ci-build.yml +++ b/.azure-pipelines/daily-ci-build.yml @@ -44,16 +44,16 @@ extends: submodules: recursive - task: UseDotNet@2 - displayName: Set up .NET 8 + displayName: Set up .NET 10 inputs: packageType: 'sdk' - version: 8.x + version: 10.x - task: UseDotNet@2 - displayName: Set up .NET 10 + displayName: Set up .NET 11 inputs: packageType: 'sdk' - version: 10.x + version: 11.x - task: NuGetAuthenticate@1 displayName: Authenticate to Azure Artifacts diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index c39284fd8..2dcdaa02c 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -41,8 +41,8 @@ jobs: uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0 with: dotnet-version: | - 8.x 10.x + 11.x - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis @@ -74,8 +74,8 @@ jobs: run: | $ErrorActionPreference = 'Stop' $PSNativeCommandUseErrorActionPreference = $true - ./.sonar/scanner/dotnet-sonarscanner begin /k:"microsoftgraph_msgraph-sdk-dotnet-core" /o:"microsoftgraph2" /d:sonar.scanner.scanAll=false /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="tests/Microsoft.Graph.DotnetCore.Core.Test/coverage.net8.0.opencover.xml" + ./.sonar/scanner/dotnet-sonarscanner begin /k:"microsoftgraph_msgraph-sdk-dotnet-core" /o:"microsoftgraph2" /d:sonar.scanner.scanAll=false /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="tests/Microsoft.Graph.DotnetCore.Core.Test/coverage.net11.0.opencover.xml" dotnet workload restore dotnet build /p:UseSharedCompilation=false - dotnet test Microsoft.Graph.Core.sln --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --framework net8.0 + dotnet test Microsoft.Graph.Core.sln --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --framework net11.0 ./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" diff --git a/.github/workflows/validatePullRequest.yml b/.github/workflows/validatePullRequest.yml index e93eb5d69..897d15752 100644 --- a/.github/workflows/validatePullRequest.yml +++ b/.github/workflows/validatePullRequest.yml @@ -23,15 +23,15 @@ jobs: steps: - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 - - name: Setup .NET 8 + - name: Setup .NET 10 uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0 with: - dotnet-version: 8.0.x + dotnet-version: 10.0.x - - name: Setup .NET 10 + - name: Setup .NET 11 uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0 with: - dotnet-version: 10.0.x + dotnet-version: 11.0.x - name: Setup JDK for android targets uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 @@ -71,8 +71,8 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0 with: - dotnet-version: 10.x + dotnet-version: 11.x - name: Validate Trimming warnings - run: dotnet publish -c Release -r win-x64 /p:TreatWarningsAsErrors=true /warnaserror -f net10.0 + run: dotnet publish -c Release -r win-x64 /p:TreatWarningsAsErrors=true /warnaserror -f net11.0 working-directory: ./tests/Microsoft.Graph.DotnetCore.Core.Trimming \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d9caca856..6dbe8663f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,6 +13,18 @@ All pull requests should be submitted against the **main** branch or a specific Some things to note about this project: +## Building and testing + +Install the .NET 11 SDK selected by `global.json` and the .NET 10 runtime to run +the retained .NET 10 tests. On Windows, run `dotnet build Microsoft.Graph.Core.sln` +and `dotnet test Microsoft.Graph.Core.sln`. The test project targets .NET Framework +4.6.2, .NET 10, and .NET 11; on other platforms, select `--framework net10.0` +or `--framework net11.0` when running tests. + +Validate trimming and Native AOT with +`dotnet publish tests\Microsoft.Graph.DotnetCore.Core.Trimming\Microsoft.Graph.DotnetCore.Core.Trimming.csproj -c Release -r win-x64 -f net11.0 /p:TreatWarningsAsErrors=true /warnaserror` +on Windows with the Native AOT build prerequisites installed. + ## Publishing NuGet packages The release pipeline in `pipelines/productionBuild.yml` builds and signs `Microsoft.Graph.Core`. diff --git a/README.md b/README.md index 27f91f4fd..49120d3cc 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Integrate the [Microsoft Graph API](https://graph.microsoft.com) into your .NET project! -The Microsoft Graph .NET Core Client Library contains core classes and interfaces used by [Microsoft.Graph Client Library](https://github.com/microsoftgraph/msgraph-sdk-dotnet) to send native HTTP requests to [Microsoft Graph API](https://graph.microsoft.com). The latest core client library targets .NetStandard 2.0. +The Microsoft Graph .NET Core Client Library contains core classes and interfaces used by [Microsoft.Graph Client Library](https://github.com/microsoftgraph/msgraph-sdk-dotnet) to send native HTTP requests to [Microsoft Graph API](https://graph.microsoft.com). The core client library targets .NET Standard 2.0 and 2.1, .NET Framework 4.6.2, .NET 10, and .NET 11. A dedicated .NET 8 target is no longer provided. Optional .NET 10 MAUI targets remain available when building with `-p:IncludeMauiTargets=true`. ## Installation via NuGet diff --git a/global.json b/global.json index afedd64bf..35af1d833 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.202", + "version": "11.0.100", "rollForward": "major" } } \ No newline at end of file diff --git a/pipelines/productionBuild.yml b/pipelines/productionBuild.yml index 7d9c2a946..6f514701b 100644 --- a/pipelines/productionBuild.yml +++ b/pipelines/productionBuild.yml @@ -43,14 +43,14 @@ extends: - checkout: self clean: true fetchDepth: 1 - - task: UseDotNet@2 - displayName: 'Use .NET 8' - inputs: - version: 8.x - task: UseDotNet@2 displayName: 'Use .NET 10' inputs: version: 10.x + - task: UseDotNet@2 + displayName: 'Use .NET 11' + inputs: + version: 11.x - task: PowerShell@2 displayName: 'Set Java Home to use Java 11' inputs: diff --git a/src/Microsoft.Graph.Core/Microsoft.Graph.Core.csproj b/src/Microsoft.Graph.Core/Microsoft.Graph.Core.csproj index c7eaad170..ab7bd062e 100644 --- a/src/Microsoft.Graph.Core/Microsoft.Graph.Core.csproj +++ b/src/Microsoft.Graph.Core/Microsoft.Graph.Core.csproj @@ -31,7 +31,7 @@ - https://github.com/microsoftgraph/msgraph-sdk-dotnet-core/blob/main/CHANGELOG.md - netstandard2.0;netstandard2.1;net462;net8.0;net10.0 + netstandard2.0;netstandard2.1;net462;net10.0;net11.0 $(TargetFrameworks);$(MauiTargets) true true diff --git a/src/Microsoft.Graph.Core/global.json b/src/Microsoft.Graph.Core/global.json index afedd64bf..35af1d833 100644 --- a/src/Microsoft.Graph.Core/global.json +++ b/src/Microsoft.Graph.Core/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.202", + "version": "11.0.100", "rollForward": "major" } } \ No newline at end of file diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Test/Microsoft.Graph.DotnetCore.Core.Test.csproj b/tests/Microsoft.Graph.DotnetCore.Core.Test/Microsoft.Graph.DotnetCore.Core.Test.csproj index ae69b1252..0e5078bbe 100644 --- a/tests/Microsoft.Graph.DotnetCore.Core.Test/Microsoft.Graph.DotnetCore.Core.Test.csproj +++ b/tests/Microsoft.Graph.DotnetCore.Core.Test/Microsoft.Graph.DotnetCore.Core.Test.csproj @@ -1,6 +1,6 @@ - net462;net8.0;net10.0 + net462;net10.0;net11.0 false false false diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Trimming/Microsoft.Graph.DotnetCore.Core.Trimming.csproj b/tests/Microsoft.Graph.DotnetCore.Core.Trimming/Microsoft.Graph.DotnetCore.Core.Trimming.csproj index 6bc8a408e..3df8af6d6 100644 --- a/tests/Microsoft.Graph.DotnetCore.Core.Trimming/Microsoft.Graph.DotnetCore.Core.Trimming.csproj +++ b/tests/Microsoft.Graph.DotnetCore.Core.Trimming/Microsoft.Graph.DotnetCore.Core.Trimming.csproj @@ -1,7 +1,7 @@ Exe - net10.0 + net11.0 enable enable true diff --git a/tests/Microsoft.Graph.DotnetCore.Core.Trimming/global.json b/tests/Microsoft.Graph.DotnetCore.Core.Trimming/global.json index 9ebe63cbc..a3cc5c82b 100644 --- a/tests/Microsoft.Graph.DotnetCore.Core.Trimming/global.json +++ b/tests/Microsoft.Graph.DotnetCore.Core.Trimming/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.202", + "version": "11.0.100", "rollForward": "major" } }