Skip to content

Update target frameworks to netstandard2.0, netstandard2.1, net462, net8.0, net10.0 #1030

@gavinbarron

Description

@gavinbarron

Summary

Update the target frameworks for the Microsoft.Graph.Core library and test projects to align with currently supported .NET runtimes.

Proposed Target Frameworks

Core library (Microsoft.Graph.Core.csproj):

  • netstandard2.0
  • netstandard2.1
  • net462
  • net8.0
  • net10.0

Test project (Microsoft.Graph.DotnetCore.Core.Test.csproj):

  • net462
  • net8.0
  • net10.0

Trimming test project (Microsoft.Graph.DotnetCore.Core.Trimming.csproj):

  • net10.0

Changes Required

  1. Update TargetFrameworks in src/Microsoft.Graph.Core/Microsoft.Graph.Core.csproj
  2. Update Directory.Build.props to remove the default net6.0 MAUI target and update MAUI platform targets from net6.0-* to net8.0-*
  3. Update test project TFMs from net6.0 to net462;net8.0;net10.0
  4. Update trimming test project TFM from net9.0 to net10.0
  5. Downgrade xunit.runner.visualstudio from 3.0.2 to 2.5.8 for net462 compatibility
  6. Add conditional compilation directives in test code for net462 compatibility:
    • Replace C# range/index syntax with compatible alternatives
    • Use new HttpMethod("PATCH") instead of HttpMethod.Patch
    • Use #if NETFRAMEWORK guards for WinHttpHandler vs SocketsHttpHandler assertions
    • Use #if NETFRAMEWORK guards for using vs await using on streams
  7. Fix HandlesCancellationTokenAsync test to use Assert.ThrowsAnyAsync<OperationCanceledException> to handle runtime differences across TFMs

Motivation

  • net6.0 and net9.0 are end-of-life
  • netstandard2.1 adds support for additional APIs (e.g., Span<T>, IAsyncDisposable)
  • net8.0 is the current LTS release
  • net10.0 is the latest supported runtime

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions