Skip to content

Commit dc2b109

Browse files
authored
.NET: Upgrade to .NET 10 (#2128)
* Upgrade to .NET 10 - Require .NET 10 SDK - Include net10.0 assets in all assemblies - Move net9.0-only targets to net10.0 - Update LangVersion to latest - Remove complicated distinctions between debug target TFMs and release target TFMs - Remove unnecessary package dependencies when built into netcoreapp - Clean up some ifdefs - Clean up some analyzer warnings * Fix CI
1 parent ee8936d commit dc2b109

File tree

328 files changed

+632
-826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

328 files changed

+632
-826
lines changed

.github/workflows/dotnet-build-and-test.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on:
1818

1919
env:
2020
COVERAGE_THRESHOLD: 80
21+
COVERAGE_FRAMEWORK: net10.0 # framework target for which we run/report code coverage
2122

2223
concurrency:
2324
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -59,23 +60,23 @@ jobs:
5960
fail-fast: false
6061
matrix:
6162
include:
62-
- { targetFramework: "net9.0", os: "ubuntu-latest", configuration: Release, integration-tests: true, environment: "integration" }
63-
- { targetFramework: "net9.0", os: "ubuntu-latest", configuration: Debug }
64-
- { targetFramework: "net9.0", os: "windows-latest", configuration: Release }
63+
- { targetFramework: "net10.0", os: "ubuntu-latest", configuration: Release, integration-tests: true, environment: "integration" }
64+
- { targetFramework: "net9.0", os: "windows-latest", configuration: Debug }
65+
- { targetFramework: "net8.0", os: "ubuntu-latest", configuration: Release }
6566
- { targetFramework: "net472", os: "windows-latest", configuration: Release, integration-tests: true, environment: "integration" }
6667

6768
runs-on: ${{ matrix.os }}
6869
environment: ${{ matrix.environment }}
6970
steps:
7071
- uses: actions/checkout@v5
7172
with:
72-
persist-credentials: false
73-
sparse-checkout: |
74-
.
75-
.github
76-
dotnet
77-
python
78-
workflow-samples
73+
persist-credentials: false
74+
sparse-checkout: |
75+
.
76+
.github
77+
dotnet
78+
python
79+
workflow-samples
7980
8081
- name: Setup dotnet
8182
uses: actions/[email protected]
@@ -123,7 +124,7 @@ jobs:
123124
popd
124125
rm -rf "$TEMP_DIR"
125126
126-
- name: Run Unit Tests Windows
127+
- name: Run Unit Tests
127128
shell: bash
128129
run: |
129130
export UT_PROJECTS=$(find ./dotnet -type f -name "*.UnitTests.csproj" | tr '\n' ' ')
@@ -133,12 +134,16 @@ jobs:
133134
134135
# Check if the project supports the target framework
135136
if [[ "$target_frameworks" == *"${{ matrix.targetFramework }}"* ]]; then
136-
dotnet test -f ${{ matrix.targetFramework }} -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx --collect:"XPlat Code Coverage" --results-directory:"TestResults/Coverage/" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.ExcludeByAttribute=GeneratedCodeAttribute,CompilerGeneratedAttribute,ExcludeFromCodeCoverageAttribute
137+
if [[ "${{ matrix.targetFramework }}" == "${{ env.COVERAGE_FRAMEWORK }}" ]]; then
138+
dotnet test -f ${{ matrix.targetFramework }} -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx --collect:"XPlat Code Coverage" --results-directory:"TestResults/Coverage/" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.ExcludeByAttribute=GeneratedCodeAttribute,CompilerGeneratedAttribute,ExcludeFromCodeCoverageAttribute
139+
else
140+
dotnet test -f ${{ matrix.targetFramework }} -c ${{ matrix.configuration }} $project --no-build -v Normal --logger trx
141+
fi
137142
else
138143
echo "Skipping $project - does not support target framework ${{ matrix.targetFramework }} (supports: $target_frameworks)"
139144
fi
140145
done
141-
146+
142147
- name: Log event name and matrix integration-tests
143148
shell: bash
144149
run: echo "github.event_name:${{ github.event_name }} matrix.integration-tests:${{ matrix.integration-tests }} github.event.action:${{ github.event.action }} github.event.pull_request.merged:${{ github.event.pull_request.merged }}"
@@ -194,19 +199,22 @@ jobs:
194199

195200
# Generate test reports and check coverage
196201
- name: Generate test reports
202+
if: matrix.targetFramework == env.COVERAGE_FRAMEWORK
197203
uses: danielpalme/[email protected]
198204
with:
199205
reports: "./TestResults/Coverage/**/coverage.cobertura.xml"
200206
targetdir: "./TestResults/Reports"
201207
reporttypes: "HtmlInline;JsonSummary"
202208

203209
- name: Upload coverage report artifact
210+
if: matrix.targetFramework == env.COVERAGE_FRAMEWORK
204211
uses: actions/upload-artifact@v5
205212
with:
206213
name: CoverageReport-${{ matrix.os }}-${{ matrix.targetFramework }}-${{ matrix.configuration }} # Artifact name
207214
path: ./TestResults/Reports # Directory containing files to upload
208215

209216
- name: Check coverage
217+
if: matrix.targetFramework == env.COVERAGE_FRAMEWORK
210218
shell: pwsh
211219
run: .github/workflows/dotnet-check-coverage.ps1 -JsonReportPath "TestResults/Reports/Summary.json" -CoverageThreshold $env:COVERAGE_THRESHOLD
212220

.github/workflows/dotnet-format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
include:
25-
- { dotnet: "9.0", configuration: Release, os: ubuntu-latest }
25+
- { dotnet: "10.0", configuration: Release, os: ubuntu-latest }
2626

2727
runs-on: ${{ matrix.os }}
2828
env:

TRANSPARENCY_FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Microsoft Agent Framework relies on existing LLMs. Using the framework retains c
4242

4343
**Framework-Specific Limitations**:
4444

45-
- **Platform Requirements**: Python 3.10+ required, specific .NET versions (.NET 8.0, 9.0, netstandard2.0, net472)
45+
- **Platform Requirements**: Python 3.10+ required, specific .NET versions (.NET 8.0, 9.0, 10.0, netstandard2.0, net472)
4646
- **API Dependencies**: Requires proper configuration of LLM provider keys and endpoints
4747
- **Orchestration Features**: Advanced orchestration patterns like GroupChat, Sequential, and Concurrent orchestrations are "coming soon" for Python implementation
4848
- **Privacy and Data Protection**: The framework allows for human participation in conversations between agents. It is important to ensure that user data and conversations are protected and that developers use appropriate measures to safeguard privacy.

dotnet/Directory.Build.props

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
77
<AnalysisLevel>latest</AnalysisLevel>
88
<GenerateDocumentationFile>true</GenerateDocumentationFile>
9-
<LangVersion>13</LangVersion>
9+
<LangVersion>latest</LangVersion>
1010
<Nullable>enable</Nullable>
1111
<NoWarn>$(NoWarn);NU5128</NoWarn>
1212
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
13-
<ProjectsCoreTargetFrameworks>net9.0;net8.0</ProjectsCoreTargetFrameworks>
14-
<ProjectsDebugCoreTargetFrameworks>net9.0</ProjectsDebugCoreTargetFrameworks>
15-
<ProjectsTargetFrameworks>net9.0;net8.0;netstandard2.0;net472</ProjectsTargetFrameworks>
16-
<ProjectsDebugTargetFrameworks>net9.0;net472</ProjectsDebugTargetFrameworks>
13+
<TargetFrameworksCore>net10.0;net9.0;net8.0</TargetFrameworksCore>
14+
<TargetFrameworks>$(TargetFrameworksCore);netstandard2.0;net472</TargetFrameworks>
1715
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))">true</IsAotCompatible>
1816
<Configurations>Debug;Release;Publish</Configurations>
1917
</PropertyGroup>

dotnet/Directory.Build.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Sdk Name="Microsoft.Build.CentralPackageVersions" Version="2.1.3" />
66
<!-- Only run 'dotnet format' on dev machines, Release builds. Skip on GitHub Actions -->
77
<!-- as this runs in its own Actions job. -->
8-
<Target Name="DotnetFormatOnBuild" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Release' AND '$(GITHUB_ACTIONS)' == '' AND '$(TargetFramework)' == '$(ProjectsDebugTargetFrameworks)'">
8+
<Target Name="DotnetFormatOnBuild" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Release' AND '$(GITHUB_ACTIONS)' == '' ">
99
<Message Text="Running dotnet format" Importance="high" />
1010
<Exec Command="dotnet format --no-restore -v diag $(ProjectFileName)" />
1111
</Target>

dotnet/Directory.Packages.props

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.13.0" />
4949
<PackageVersion Include="OpenTelemetry.Instrumentation.Runtime" Version="1.13.0" />
5050
<!-- Microsoft.AspNetCore.* -->
51-
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="9.0.11" />
51+
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
5252
<PackageVersion Include="Swashbuckle.AspNetCore.SwaggerUI" Version="10.0.0" />
5353
<!-- Microsoft.Extensions.* -->
5454
<PackageVersion Include="Microsoft.Extensions.AI" Version="10.0.0" />
@@ -80,11 +80,11 @@
8080
<PackageVersion Include="Microsoft.SemanticKernel.Agents.AzureAI" Version="1.67.0-preview" />
8181
<PackageVersion Include="Microsoft.SemanticKernel.Plugins.OpenApi" Version="1.67.0" />
8282
<!-- Agent SDKs -->
83-
<PackageVersion Include="Microsoft.Agents.CopilotStudio.Client" Version="1.2.41" />
83+
<PackageVersion Include="Microsoft.Agents.CopilotStudio.Client" Version="1.3.171-beta" />
8484
<!-- M365 Agents SDK -->
8585
<PackageVersion Include="AdaptiveCards" Version="3.1.0" />
86-
<PackageVersion Include="Microsoft.Agents.Authentication.Msal" Version="1.2.41" />
87-
<PackageVersion Include="Microsoft.Agents.Hosting.AspNetCore" Version="1.2.41" />
86+
<PackageVersion Include="Microsoft.Agents.Authentication.Msal" Version="1.3.171-beta" />
87+
<PackageVersion Include="Microsoft.Agents.Hosting.AspNetCore" Version="1.3.171-beta" />
8888
<!-- A2A -->
8989
<PackageVersion Include="A2A" Version="0.3.3-preview" />
9090
<PackageVersion Include="A2A.AspNetCore" Version="0.3.3-preview" />
@@ -117,11 +117,11 @@
117117
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.1.0" />
118118
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Extensions.Mcp" Version="1.0.0" />
119119
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.7" />
120-
<!-- Community -->
121-
<PackageVersion Include="System.Linq.Async" Version="6.0.3" />
122120
<!-- Test -->
123121
<PackageVersion Include="FluentAssertions" Version="8.8.0" />
124-
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="9.0.11" />
122+
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Condition="'$(TargetFramework)' == 'net8.0'" Version="8.0.22" />
123+
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Condition="'$(TargetFramework)' == 'net9.0'" Version="9.0.11" />
124+
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Condition="'$(TargetFramework)' == 'net10.0'" Version="10.0.0" />
125125
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
126126
<PackageVersion Include="Moq" Version="[4.18.4]" />
127127
<PackageVersion Include="xunit" Version="2.9.3" />

dotnet/global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"sdk": {
3-
"version": "9.0.300",
4-
"rollForward": "latestMajor",
3+
"version": "10.0.100",
4+
"rollForward": "minor",
55
"allowPrerelease": false
66
}
77
}

dotnet/samples/A2AClientServer/A2AClient/A2AClient.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFrameworks>net10.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<UserSecretsId>5ee045b0-aea3-4f08-8d31-32d1a6f8fed0</UserSecretsId>
@@ -12,8 +12,11 @@
1212
<PackageReference Include="A2A" />
1313
<PackageReference Include="System.CommandLine" />
1414
<PackageReference Include="Microsoft.Extensions.Hosting" />
15-
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" VersionOverride="10.0.0-rc.2.25502.107" />
16-
<PackageReference Include="System.Net.ServerSentEvents" VersionOverride="10.0.0-rc.2.25502.107" />
15+
</ItemGroup>
16+
17+
<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'net10.0'))">
18+
<PackageReference Include="System.Net.ServerSentEvents" />
19+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
1720
</ItemGroup>
1821

1922
<ItemGroup>

dotnet/samples/A2AClientServer/A2AServer/A2AServer.csproj

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFrameworks>net10.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<UserSecretsId>5ee045b0-aea3-4f08-8d31-32d1a6f8fed0</UserSecretsId>
@@ -11,8 +11,11 @@
1111
<ItemGroup>
1212
<PackageReference Include="Azure.AI.Agents.Persistent" />
1313
<PackageReference Include="Azure.Identity" />
14-
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" VersionOverride="10.0.0-rc.2.25502.107" />
15-
<PackageReference Include="System.Net.ServerSentEvents" VersionOverride="10.0.0-rc.2.25502.107" />
14+
</ItemGroup>
15+
16+
<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'net10.0'))">
17+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
18+
<PackageReference Include="System.Linq.AsyncEnumerable" />
1619
</ItemGroup>
1720

1821
<ItemGroup>

dotnet/samples/A2AClientServer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ dotnet run --urls "http://localhost:5002;https://localhost:5012" --agentId "<Log
103103

104104
### Testing the Agents using the Rest Client
105105

106-
This sample contains a [.http file](https://learn.microsoft.com/aspnet/core/test/http-files?view=aspnetcore-9.0) which can be used to test the agent.
106+
This sample contains a [.http file](https://learn.microsoft.com/aspnet/core/test/http-files?view=aspnetcore-10.0) which can be used to test the agent.
107107

108108
1. In Visual Studio open [./A2AServer/A2AServer.http](./A2AServer/A2AServer.http)
109109
1. There are two sent requests for each agent, e.g., for the invoice agent:

0 commit comments

Comments
 (0)