Skip to content

Commit 2f9d0e1

Browse files
authored
[EngSys] .NET 10 Migration (#862)
* [EngSys] .NET 10 Migration The focus of these changes is to move the repository to .NET 10, including the SDK, target frameworks, and BCL package dependencies.
1 parent 8639c48 commit 2f9d0e1

File tree

10 files changed

+74
-44
lines changed

10 files changed

+74
-44
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# For more information, see https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
33

44
# The '*' pattern represents global owners.
5-
* @joseharriaga @trrwilson @ShivangiReja
5+
* @joseharriaga @christothes @ShivangiReja @jsquire

.github/workflows/codegen-validation.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
validate-codegen:
2121
name: Validate Code Generation
2222
runs-on: ubuntu-latest
23-
23+
2424
steps:
2525
- name: Checkout code
2626
uses: actions/checkout@v4
@@ -29,7 +29,7 @@ jobs:
2929
uses: actions/setup-node@v4
3030
with:
3131
node-version: '22.x'
32-
32+
3333
- name: Setup .NET
3434
uses: actions/setup-dotnet@v4
3535
with:
@@ -41,14 +41,14 @@ jobs:
4141
run: |
4242
Write-Host "Running code generation validation..."
4343
./scripts/Invoke-CodeGen.ps1 -Clean
44-
44+
4545
if ($LASTEXITCODE -ne 0) {
4646
Write-Error "Code generation failed with exit code: $LASTEXITCODE"
4747
exit $LASTEXITCODE
4848
}
49-
49+
5050
Write-Host "Code generation completed successfully!"
51-
51+
5252
- name: Check for uncommitted changes
5353
run: |
5454
# Check if there are any changes to tracked files after code generation
@@ -60,24 +60,24 @@ jobs:
6060
git diff
6161
exit 1
6262
fi
63-
63+
6464
# Also check for untracked files that might have been generated
6565
if [ -n "$(git ls-files --others --exclude-standard)" ]; then
6666
echo "::error::Code generation produced untracked files. Please review and commit them if they should be included."
6767
echo "Untracked files:"
6868
git ls-files --others --exclude-standard
6969
exit 1
7070
fi
71-
71+
7272
echo "No uncommitted changes detected - code generation is up to date!"
73-
73+
7474
- name: Run codegen visitor tests
7575
run: dotnet test codegen/generator/test/
7676
--configuration Release
7777
--logger "trx;LogFilePrefix=codegen"
7878
--results-directory ${{github.workspace}}/artifacts/test-results
7979
${{ env.version_suffix_args}}
80-
80+
8181
- name: Upload artifacts
8282
uses: actions/upload-artifact@v4
8383
if: ${{ !cancelled() }}

.github/workflows/live-test.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ jobs:
1616
env:
1717
version_suffix_args: ${{ format('/p:VersionSuffix="alpha.{0}"', github.run_number) }}
1818
steps:
19-
- name: Setup .NET
19+
- name: Setup .NET 10
20+
uses: actions/setup-dotnet@v3
21+
with:
22+
dotnet-version: '10.x'
23+
24+
- name: Setup .NET 9
2025
uses: actions/setup-dotnet@v3
2126
with:
2227
dotnet-version: '9.x'

.github/workflows/main.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ jobs:
1717
env:
1818
version_suffix_args: ${{ format('/p:VersionSuffix="alpha.{0}"', github.run_number) }}
1919
steps:
20-
- name: Setup .NET
20+
- name: Setup .NET 10
21+
uses: actions/setup-dotnet@v3
22+
with:
23+
dotnet-version: '10.x'
24+
25+
- name: Setup .NET 9
2126
uses: actions/setup-dotnet@v3
2227
with:
2328
dotnet-version: '9.x'

.github/workflows/release.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ jobs:
2323
env:
2424
version_suffix_args: ${{ github.event_name == 'schedule' && format('/p:VersionSuffix="alpha.{0}"', github.run_number) || '' }}
2525
steps:
26-
- name: Setup .NET
26+
- name: Setup .NET 10
27+
uses: actions/setup-dotnet@v3
28+
with:
29+
dotnet-version: '10.x'
30+
31+
- name: Setup .NET 9
2732
uses: actions/setup-dotnet@v3
2833
with:
2934
dotnet-version: '9.x'
@@ -78,22 +83,22 @@ jobs:
7883
environment: release # Needed for OIDC subject for releases triggered on release being created.
7984
permissions:
8085
id-token: write # Required for requesting the JWT
81-
86+
8287
steps:
8388
- name: Download build artifacts
8489
uses: actions/download-artifact@v4
8590
with:
8691
name: build-artifacts
8792
path: ${{ github.workspace }}/build-artifacts
88-
93+
8994
- name: Setup .NET
9095
uses: actions/setup-dotnet@v3
9196
with:
9297
dotnet-version: '9.x'
93-
98+
9499
- name: Install Sign CLI tool
95100
run: dotnet tool install --tool-path . --prerelease sign
96-
101+
97102
- name: 'Az CLI login'
98103
uses: azure/login@v2
99104
with:
@@ -113,13 +118,13 @@ jobs:
113118
--azure-credential-type "azure-cli"
114119
--azure-key-vault-url "https://sc-openaisdk.vault.azure.net/"
115120
--azure-key-vault-certificate "OpenAISDKSCCert"
116-
121+
117122
- name: Upload signed artifact
118123
uses: actions/upload-artifact@v4
119124
with:
120125
name: build-artifacts-signed
121126
path: ${{ github.workspace }}/build-artifacts
122-
127+
123128
deploy:
124129
name: Publish package
125130
needs: sign

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "9.0.306",
3+
"version": "10.0.100",
44
"rollForward": "feature"
55
}
6-
}
6+
}

nuget.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<packageSource key="azure-sdk-dev-feed">
1111
<package pattern="System.ClientModel" />
1212
<package pattern="Microsoft.ClientModel.TestFramework" />
13+
<package pattern="Azure.Sdk.Tools.*" />
1314
</packageSource>
1415
<packageSource key="nuget">
1516
<package pattern="*" />

src/OpenAI.csproj

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<Description>
44
The official .NET library for the OpenAI service API.
55
</Description>
6-
<AssemblyTitle>SDK Code Generation OpenAI</AssemblyTitle>
6+
<AssemblyTitle>OpenAI client library for .NET</AssemblyTitle>
77
<PackageTags>OpenAI;openai-dotnet;ChatGPT;Dall-E</PackageTags>
88
<PackageLicenseExpression>MIT</PackageLicenseExpression>
9-
<Copyright>Copyright (c) 2024 OpenAI (https://openai.com)</Copyright>
9+
<Copyright>Copyright (c) 2025 OpenAI (https://openai.com)</Copyright>
1010

1111
<VersionPrefix>2.8.0</VersionPrefix>
1212
<VersionSuffix></VersionSuffix>
1313

14-
<TargetFrameworks>net8.0;netstandard2.0</TargetFrameworks>
14+
<TargetFrameworks>net10.0;net8.0;netstandard2.0</TargetFrameworks>
1515
<LangVersion>latest</LangVersion>
1616

1717
<!-- Generate an XML documentation file for the project. -->
@@ -62,23 +62,29 @@
6262
<InternalsVisibleTo Include="Azure.AI.OpenAI" Condition="'$(Configuration)' == 'Unsigned'" />
6363
</ItemGroup>
6464

65-
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
66-
<!-- Normalize stored file paths in symbols when in a CI build. -->
67-
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
68-
</PropertyGroup>
6965
<ItemGroup>
7066
<None Include="OpenAI.png" Pack="true" PackagePath="\" />
7167
<None Include="..\CHANGELOG.md" Pack="true" PackagePath="\" />
7268
<None Include="..\README.md" Pack="true" PackagePath="\" />
7369
</ItemGroup>
7470

7571
<ItemGroup>
76-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
7772
<PackageReference Include="System.ClientModel" Version="1.8.1" />
78-
<PackageReference Include="System.Net.ServerSentEvents" Version="9.0.9" />
73+
<PackageReference Include="System.Net.ServerSentEvents" Version="10.0.0" />
74+
</ItemGroup>
75+
76+
<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
77+
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="10.0.0" />
7978
</ItemGroup>
8079

81-
<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">
82-
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="8.0.1" />
80+
<!-- Build-only dependencies -->
81+
<ItemGroup>
82+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
8383
</ItemGroup>
84+
85+
<!-- Build and release configuration -->
86+
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
87+
<!-- Normalize stored file paths in symbols when in a CI build. -->
88+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
89+
</PropertyGroup>
8490
</Project>

tests/OpenAI.Tests.csproj

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net9.0</TargetFrameworks>
3+
<TargetFrameworks>net10.0;net9.0;net8.0</TargetFrameworks>
4+
<LangVersion>latest</LangVersion>
45

56
<!--Ignore XML doc comments on test types and members-->
67
<NoWarn>$(NoWarn);CS1591</NoWarn>
78

8-
<!-- OPENAI001 - Ignore experimental warnings-->
9-
<NoWarn>$(NoWarn);OPENAI001;SCME0001;</NoWarn>
10-
11-
<LangVersion>latest</LangVersion>
9+
<!-- OPENAI001 - Ignore experimental warnings-->
10+
<NoWarn>$(NoWarn);OPENAI001;OPENAI002;SCME0001;</NoWarn>
1211
</PropertyGroup>
12+
1313
<ItemGroup>
1414
<ProjectReference Include="..\src\OpenAI.csproj" />
1515
</ItemGroup>
16+
1617
<ItemGroup>
17-
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
18-
<PackageReference Include="NUnit" Version="4.4.0" />
19-
<PackageReference Include="NUnit3TestAdapter" Version="5.1.0" />
20-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
18+
<PackageReference Include="Microsoft.ClientModel.TestFramework" Version="1.0.0-alpha.20250919.1" />
19+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
2120
<PackageReference Include="Moq" Version="[4.18.2]" />
22-
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
23-
<PackageReference Include="Microsoft.ClientModel.TestFramework" Version="1.0.0-alpha.20250919.1" />
21+
<PackageReference Include="NUnit" Version="4.4.0" />
22+
<PackageReference Include="NUnit3TestAdapter" Version="6.0.0" />
23+
<PackageReference Include="System.Linq.AsyncEnumerable" Version="10.0.0" />
2424
</ItemGroup>
2525

26+
<!-- Conditionally include packages built into the latest runtime -->
27+
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net10.0')) == 'false'">
28+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.0" />
29+
</ItemGroup>
30+
2631
<ItemGroup>
2732
<Compile Include="..\src\Utility\Telemetry\*.cs" LinkBase="Telemetry\Shared" />
2833
<Compile Include="..\src\Utility\AppContextSwitchHelper.cs" LinkBase="Telemetry\Shared" />

tests/Responses/ResponsesTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,10 @@ public async Task AllInstructionMethodsWork(ResponsesTestInstructionMethod instr
760760
}
761761

762762
List<ResponseItem> listedItems = [];
763-
await client.GetResponseInputItemsAsync(new ResponseItemCollectionOptions(response.Id)).ForEachAsync(item => listedItems.Add(item));
763+
await foreach (var item in client.GetResponseInputItemsAsync(response.Id))
764+
{
765+
listedItems.Add(item);
766+
}
764767

765768
if (instructionMethod == ResponsesTestInstructionMethod.InstructionsProperty)
766769
{

0 commit comments

Comments
 (0)