Skip to content

Commit f5e8a84

Browse files
committed
[EngSys] .NET 10 Migration
The focus of these changes is to move the repository to the .NET 10 SDK and update target frameworks to account for the new LTS version.
1 parent 5920767 commit f5e8a84

File tree

67 files changed

+191
-151
lines changed

Some content is hidden

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

67 files changed

+191
-151
lines changed

common/SmokeTests/SmokeTest/SmokeTest.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFrameworks>net9.0;net8.0;net462</TargetFrameworks>
5-
<LangVersion>11.0</LangVersion>
4+
<TargetFrameworks>net10.0;net9.0;net8.0;net462</TargetFrameworks>
5+
<LangVersion>latest</LangVersion>
66
<NoWarn>$(NoWarn);NU1605</NoWarn>
77
</PropertyGroup>
88

doc/ApiDocGeneration/assets/docgen.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net8.0</TargetFrameworks>
3+
<TargetFrameworks>$(LtsTargetFramework)</TargetFrameworks>
44
<Description>This is a dummy project used to restore nuget packages used for doc generation</Description>
55
<AssemblyTitle>Doc generation Packages</AssemblyTitle>
66
</PropertyGroup>

eng/Directory.Build.Common.props

Lines changed: 70 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
<!-- Setup default project properties -->
3434
<PropertyGroup>
35-
<LtsTargetFramework>net8.0</LtsTargetFramework>
3635
<LangVersion>latest</LangVersion>
3736
<!--
3837
Disable NU5105 NuGet Pack warning that the version is SemVer 2.0.
@@ -112,6 +111,10 @@
112111
<DefineConstants Condition="'$(BuildSnippets)' == 'true'">$(DefineConstants);SNIPPET</DefineConstants>
113112
<AotCompatOptOut>false</AotCompatOptOut>
114113
<ApiCompatBaselineTargetFramework Condition="'$(TargetFramework)' == '$(LtsTargetFramework)'">netstandard2.0</ApiCompatBaselineTargetFramework>
114+
115+
<!-- All current generation client libraries must support .NET Standard 2.0 unless the architects approve a specific exception. -->
116+
<SupportsNetStandard20 Condition="'$(SupportsNetStandard20)' == '' and '$(IsClientLibrary)' == 'true'">true</SupportsNetStandard20>
117+
<SupportsNetStandard20 Condition="'$(SupportsNetStandard20)' == ''">false</SupportsNetStandard20>
115118
</PropertyGroup>
116119

117120
<PropertyGroup Condition="'$(IsShippingClientLibrary)' == 'true' and '$(TF_BUILD)' == 'true'">
@@ -144,43 +147,90 @@
144147
<CodeAnalysisRuleSet>$(RepoEngPath)\CodeAnalysis.ruleset</CodeAnalysisRuleSet>
145148
</PropertyGroup>
146149

147-
<!-- TargetFramework default properties -->
148-
<!-- Update pipelines/templates/steps/install-dotnet.yml as needed, without re-installing SDKs already found on all supported agents -->
150+
<!--
151+
TARGET FRAMEWORK DEFINITIONS
152+
153+
Define the target frameworks that client libraries must support by default. These will change
154+
as new .NET versions are released and older versions reach end-of-life. See:
155+
https://azure.github.io/azure-sdk/dotnet_introduction.html#target-frameworks
156+
157+
IMPORTANT NOTES:
158+
159+
- When multiple frameworks are present, list from newest to oldest so that the most recent version
160+
is used by default for test runs.
161+
162+
- When updating, change pipelines/templates/steps/install-dotnet.yml as needed, without
163+
re-installing SDKs already found on all supported agents.
164+
-->
149165
<PropertyGroup>
150-
<!-- Client libraries are moving forward to NS 2.0 and Net 4.6.1 as the min supported versions -->
151-
<SupportsNetStandard20 Condition="'$(SupportsNetStandard20)' == '' and '$(IsClientLibrary)' == 'true'">true</SupportsNetStandard20>
152-
<SupportsNetStandard20 Condition="'$(SupportsNetStandard20)' == ''">false</SupportsNetStandard20>
166+
<!-- Targets used by the current generation of the Azure SDK libraries. -->
167+
<LtsTargetFramework>net10.0</LtsTargetFramework>
168+
<RequiredRunnableTargetFrameworks>$(LtsTargetFramework);net8.0</RequiredRunnableTargetFrameworks>
153169

154-
<RequiredTargetFrameworks>net452;net461;netstandard2.0</RequiredTargetFrameworks>
155-
<RequiredTargetFrameworks Condition="'$(SupportsNetStandard20)' == 'true' and '$(IsSourceGenerator)' != 'true'">$(LtsTargetFramework);netstandard2.0</RequiredTargetFrameworks>
156-
<RequiredTargetFrameworks Condition="'$(IsGeneratorLibrary)' == 'true'">$(LtsTargetFramework)</RequiredTargetFrameworks>
170+
<!-- The set of all runnable modern target frameworks that have not yet reached end-of-life. -->
171+
<AllActiveCurrentTargetFrameworks>$(RequiredRunnableTargetFrameworks);net9.0</AllActiveCurrentTargetFrameworks>
172+
173+
<!-- The earliest version of the legacy .NET Framework that us still supported. -->
174+
<!-- `net462` reaches end-of-life in Jan, 2027. -->
175+
<NetFxTargetFramework>net462</NetFxTargetFramework>
176+
177+
<!-- Targets only for legacy libraries, not the current Azure SDK generation. -->
178+
<DefaultLegacyTargetFrameworks>net452;net461;netstandard2.0</DefaultLegacyTargetFrameworks>
179+
180+
<!--
181+
DEFINE THE REQUIRED TARGETS FOR A GIVEN LIBRARY TYPE
182+
183+
Define the target frameworks that a given library type must support by default.
184+
These can be overridden on a per-project basis by setting the RequiredTargetFrameworks
185+
property in the project file.
186+
-->
187+
188+
<!-- By default, assume a legacy library. -->
189+
<RequiredTargetFrameworks>$(DefaultLegacyTargetFrameworks)</RequiredTargetFrameworks>
190+
191+
<!-- The current generation of Azure SDK will be marked as supporting support netstandard2.0 -->
192+
<RequiredTargetFrameworks Condition="'$(SupportsNetStandard20)' == 'true'">$(RequiredRunnableTargetFrameworks);netstandard2.0</RequiredTargetFrameworks>
193+
194+
<!-- Source generators, such as System.ClientModel.SourceGeneration, must only target netstandard2.0 -->
157195
<RequiredTargetFrameworks Condition="'$(IsSourceGenerator)' == 'true'">netstandard2.0</RequiredTargetFrameworks>
196+
197+
<!-- Libraries that are part of our code generator only support the current LTS framework -->
198+
<RequiredTargetFrameworks Condition="'$(IsGeneratorLibrary)' == 'true'">$(LtsTargetFramework)</RequiredTargetFrameworks>
158199
</PropertyGroup>
159200

201+
<!--
202+
TARGET FRAMEWORK OVERRIDES FOR TESTS, SAMPLES, AND SUPPORT PROJECTS
203+
204+
Test, sample, and support projects require a runnable target framework to execute, so they
205+
cannot include a netstandard target, even if the project explicitly marks itself as supporting it.
206+
-->
160207
<PropertyGroup Condition="'$(IsGeneratorLibrary)' != 'true' and ('$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true' or '$(IsSamplesProject)' == 'true' or '$(IsPerfProject)' == 'true' or '$(IsStressProject)' == 'true')">
161208
<IsPackable>false</IsPackable>
162-
<!-- List newest targets first so that recordings are made with latest, running tests from editor runs latest, etc. -->
163-
<RequiredTargetFrameworks>net9.0;$(LtsTargetFramework);</RequiredTargetFrameworks>
164-
<!-- Also test net462 on Windows. net461 is out of support as of 4/2022 and is not supported in version 4.4.x and beyond of NUnit3TestAdapter. -->
165-
<RequiredTargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(RequiredTargetFrameworks);net462</RequiredTargetFrameworks>
166-
<!-- But only build snippets for the latest. -->
209+
210+
<!-- Test runs should be performed on all runnable target frameworks that have not yet reached end-of-life. -->
211+
<RequiredTargetFrameworks>$(AllActiveCurrentTargetFrameworks)</RequiredTargetFrameworks>
212+
213+
<!-- Include the earliest supported legacy .NET framework target on Windows only. -->
214+
<RequiredTargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(RequiredTargetFrameworks);$(NetFxTargetFramework)</RequiredTargetFrameworks>
215+
216+
<!-- If test snippets are being built, do so only for the current LTS. -->
167217
<RequiredTargetFrameworks Condition="'$(BuildSnippets)' == 'true'">$(LtsTargetFramework)</RequiredTargetFrameworks>
168218
</PropertyGroup>
169219

170-
<ItemGroup Condition="('$(IsMgmtSubLibrary)' == 'true' or '$(IsGeneratorLibraryGenerationTest)' == 'true') and !$(MSBuildProjectName.Equals('Azure.ResourceManager.Tests'))">
171-
<PackageReference Include="Azure.ResourceManager" />
172-
</ItemGroup>
173-
220+
<!-- Assign target frameworks and set associated project constants -->
174221
<PropertyGroup>
175222
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
176223

177224
<IsTargetingNetFx Condition="$(TargetFramework.StartsWith('net4'))">true</IsTargetingNetFx>
178225
<IsTargetingNetStandard Condition="$(TargetFramework.StartsWith('netstandard'))">true</IsTargetingNetStandard>
179-
<IsTargetingNetCoreApp Condition="$(TargetFramework.StartsWith('netcoreapp'))">true</IsTargetingNetCoreApp>
180-
181226
<DefineConstants Condition="'$(IsTargetingNetFx)' == 'true'">$(DefineConstants);FullNetFx</DefineConstants>
182227
</PropertyGroup>
183228

229+
<!-- Inject implicit dependencies for management sub-libraries and generator library generation tests -->
230+
<ItemGroup Condition="('$(IsMgmtSubLibrary)' == 'true' or '$(IsGeneratorLibraryGenerationTest)' == 'true') and !$(MSBuildProjectName.Equals('Azure.ResourceManager.Tests'))">
231+
<PackageReference Include="Azure.ResourceManager" />
232+
</ItemGroup>
233+
184234
<!-- SourceGeneration common settings -->
185235
<PropertyGroup Condition="'$(IsSourceGenerator)' == 'true'">
186236
<OutputItemType>Analyzer</OutputItemType>

eng/Packages.Data.props

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,13 @@
371371
<PackageReference Update="Microsoft.ApplicationInsights" Version="2.23.0" />
372372
<PackageReference Update="Microsoft.ApplicationInsights.WorkerService" Version="2.23.0" />
373373
<PackageReference Update="Microsoft.Azure.ApplicationInsights.Query" Version="1.0.0" />
374-
<PackageReference Update="Microsoft.AspNetCore" Version="2.2.0" />
375-
<PackageReference Update="Microsoft.AspNetCore.Mvc.Testing" Version="8.*" />
374+
<PackageReference Update="Microsoft.AspNetCore" Version="2.3.0" />
375+
376+
<!-- The AspNetCore.Mvc.Testing package has a hard association on a specific target framework -->
377+
<PackageReference Update="Microsoft.AspNetCore.Mvc.Testing" Version="10.0.0"/>
378+
<PackageReference Update="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.11" Condition="'$(TargetFramework)' == 'net9.0'"/>
379+
<PackageReference Update="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.22" Condition="'$(TargetFramework)' == 'net8.0'"/>
380+
376381
<PackageReference Update="Microsoft.AspNetCore.Server.Kestrel" Version="2.3.0" />
377382
<PackageReference Update="Microsoft.AspNetCore.Server.Kestrel.Core" Version="2.3.6" />
378383
<PackageReference Update="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" Version="2.3.0" />

eng/packages/http-client-csharp-mgmt/generator/Azure.Generator.Management/src/Azure.Generator.Management.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net9.0</TargetFrameworks>
4-
<RequiredTargetFrameworks>net9.0</RequiredTargetFrameworks>
3+
<RequiredTargetFrameworks>$(LtsTargetFramework)</RequiredTargetFrameworks>
4+
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
55
<PackageId>Azure.Generator.Management</PackageId>
66
<Version>1.0.0-beta.1</Version>
77
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

eng/packages/http-client-csharp-mgmt/generator/Azure.Generator.Management/test/Azure.Generator.Mgmt.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net9.0</TargetFrameworks>
5-
<RequiredTargetFrameworks>net9.0</RequiredTargetFrameworks>
4+
<RequiredTargetFrameworks>$(LtsTargetFramework)</RequiredTargetFrameworks>
5+
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
66
<LangVersion>latest</LangVersion>
77
<!--This is a workaround because `Microsoft.Generator.CSharp` and `Microsoft.Generator.CSharp.Input` is not signed-->
88
<NoWarn>CS8002</NoWarn>

eng/packages/http-client-csharp-mgmt/generator/Azure.Generator.Management/test/Common/Azure.Generator.Management.Tests.Common.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net9.0</TargetFrameworks>
5-
<RequiredTargetFrameworks>net9.0</RequiredTargetFrameworks>
4+
<RequiredTargetFrameworks>$(LtsTargetFramework)</RequiredTargetFrameworks>
5+
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
<IsTestSupportProject>true</IsTestSupportProject>

eng/packages/http-client-csharp/generator/Azure.Generator.StubLibrary/src/Azure.Generator.StubLibrary.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
<PropertyGroup>
44
<PackageId>StubPlugin</PackageId>
55
<Version>1.0.0-beta.1</Version>
6-
<TargetFrameworks>net9.0</TargetFrameworks>
7-
<RequiredTargetFrameworks>net9.0</RequiredTargetFrameworks>
6+
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
87
</PropertyGroup>
98

109
<ItemGroup>

eng/packages/http-client-csharp/generator/Azure.Generator/src/Azure.Generator.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net9.0</TargetFrameworks>
4-
<RequiredTargetFrameworks>net9.0</RequiredTargetFrameworks>
3+
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
54
<PackageId>Azure.Generator</PackageId>
65
<Version>1.0.0-beta.1</Version>
76
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

eng/packages/http-client-csharp/generator/Azure.Generator/test/Azure.Generator.Tests.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net9.0</TargetFrameworks>
4-
<RequiredTargetFrameworks>net9.0</RequiredTargetFrameworks>
3+
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
54
<LangVersion>latest</LangVersion>
65
<!--This is a workaround because `Microsoft.Generator.CSharp` and `Microsoft.Generator.CSharp.Input` is not signed-->
76
<NoWarn>CS8002</NoWarn>

0 commit comments

Comments
 (0)