Skip to content

Commit 0752525

Browse files
authored
Drop netcoreapp3.1, add net7.0 support (Azure#32814)
* Drop netcoreapp3.1, add net7.0 support Resolves Azure#32596. With netcoreapp3.1 falling out of support soon, we're upgrading to net7.0, net6.0, and, on Windows, net461. * Resolve PR comments and fix build break * Tweak platform monikers * Upgrade to .NET 7.0.101 SDK Required for microsoft/vstest#4014 fix * Drop unnecessary runtimes from .vsconfig * Skip Monitor tests failing under net7.0 Relates to Azure#33403 * Resolve track 1 management plane issues on net7.0 * Resolve Key Vault issues after upgrade to net7.0 * Use different platform guard for management plane * Resolve PR feedback
1 parent d35979d commit 0752525

File tree

40 files changed

+144
-110
lines changed

40 files changed

+144
-110
lines changed

.vsconfig

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "1.0",
3+
"components": [
4+
"Microsoft.VisualStudio.Workload.ManagedDesktop",
5+
"Microsoft.Net.ComponentGroup.4.6.2-4.7.1.DeveloperTools",
6+
"Microsoft.Net.Component.4.7.2.TargetingPack",
7+
"Microsoft.Net.Component.4.6.1.TargetingPack",
8+
"Microsoft.Net.Component.4.8.SDK",
9+
"Microsoft.Component.MSBuild",
10+
"Microsoft.NetCore.Component.DevelopmentTools",
11+
"Microsoft.NetCore.Component.Runtime.7.0",
12+
"Microsoft.NetCore.Component.Runtime.6.0",
13+
"Microsoft.NetCore.Component.SDK",
14+
"Microsoft.VisualStudio.Component.Git"
15+
]
16+
}

CONTRIBUTING.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
- Install Visual Studio 2022 (Community or higher) and make sure you have the latest updates (https://www.visualstudio.com/).
1010
- Need at least .NET Framework 4.6.1 and 4.7 development tools
11-
- Install the **.NET Core cross-platform development** workloads in VisualStudio
12-
- Install **.NET Core 6.0.100 SDK** for your specific platform. (or a higher version within the 6.0.*** band) (https://dotnet.microsoft.com/download/dotnet-core/6.0)
11+
- Install the **.NET cross-platform development** workloads in VisualStudio
12+
- Install **.NET 7.0.100 SDK** for your specific platform. (or a higher version within the 7.0.*** band) (https://dotnet.microsoft.com/download/dotnet-core/7.0)
1313
- Install the latest version of git (https://git-scm.com/downloads)
1414
- Install [PowerShell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell), version 6 or higher, if you plan to make public API changes or are working with generated code snippets.
1515
- Install [NodeJS](https://nodejs.org/) (16.x.x) if you plan to use [C# code generation](https://github.com/Azure/autorest.csharp).
@@ -182,7 +182,7 @@ In some cases, you might want to test against the latest versions of the client
182182

183183
If you make public API changes or additions, the `eng\scripts\Export-API.ps1` script has to be run to update public API listings. This generates a file in the library's directory similar to the example found in `sdk\template\Azure.Template\api\Azure.Template.netstandard2.0.cs`.
184184

185-
Running the script for a project in `sdk\tables` would look like this:
185+
Running the script for a project in `sdk\tables` would look like this:
186186
```
187187
eng\scripts\Export-API.ps1 tables
188188
```
@@ -191,7 +191,7 @@ eng\scripts\Export-API.ps1 tables
191191
If the specific client library has sample snippets in markdown format, they were most likely created with help of the `eng\scripts\Update-Snippets.ps1` script.
192192
Any changes made to the snippet markdown should be done via updating the corresponding C# snippet code and subsequently running the script.
193193

194-
Running the script for a project, for example in `sdk\keyvault`, would look like this:
194+
Running the script for a project, for example in `sdk\keyvault`, would look like this:
195195
```
196196
eng\scripts\Update-Snippets.ps1 keyvault
197197
```
@@ -211,13 +211,13 @@ string ignored = "this code will not appear in the snippet markdown";
211211

212212
#endregion
213213
```
214-
will be mapped to any markdown file with a corresponding code region in the format below where the snippet names match:
214+
will be mapped to any markdown file with a corresponding code region in the format below where the snippet names match:
215215

216216
**\`\`\`C# Snippet:\<snippetName>**
217217

218218
**\`\`\`**
219219

220-
See the following example of a [snippet C# file](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/search/Azure.Search.Documents/tests/Samples/Sample01_HelloWorld.cs) and a [snippet markdown file](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/search/Azure.Search.Documents/samples/Sample01a_HelloWorld.md).
220+
See the following example of a [snippet C# file](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/search/Azure.Search.Documents/tests/Samples/Sample01_HelloWorld.cs) and a [snippet markdown file](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/search/Azure.Search.Documents/samples/Sample01a_HelloWorld.md).
221221
Note that snippet names need to be globally unique under a given service directory.
222222

223223
Snippets also can be integrated into XML doc comments. For example:
@@ -238,7 +238,7 @@ For general information about samples, see the [Samples Guidelines](https://azur
238238

239239
## Updating Source on Build
240240
You can run `eng\scripts\Export-API.ps1` and `eng\scripts\Update-Snippets.ps1` simultaneously as part of the build by setting as true either:
241-
1. The property `UpdateSourceOnBuild`
241+
1. The property `UpdateSourceOnBuild`
242242
2. The Environment variable `AZURE_DEV_UPDATESOURCESONBUILD=true`
243243

244244
e.g.
@@ -329,7 +329,7 @@ As you can see in the example below, we want to use the `Azure.Data.Tables` vers
329329

330330
## Preparing a new library release
331331

332-
To prepare a package for release you should make use of `.\eng\common\scripts\Prepare-Release.ps1` script passing it appropriate arguments for the package intended for release. This script will correctly update the package version and changelog in the repo as well as update the DevOps release work items for that release.
332+
To prepare a package for release you should make use of `.\eng\common\scripts\Prepare-Release.ps1` script passing it appropriate arguments for the package intended for release. This script will correctly update the package version and changelog in the repo as well as update the DevOps release work items for that release.
333333

334334
```
335335
.\eng\common\scripts\Prepare-Release.ps1 <PackageName> [<ServiceDirectory>] [<ReleaseDate>] [-ReleaseTrackingOnly]
@@ -419,7 +419,7 @@ See [Data Plane Quick Start Tutorial](https://github.com/Azure/azure-sdk-for-net
419419
{
420420
private const ServiceVersion Latest = ServiceVersion.V2019_06_01;
421421
internal static StorageManagementClientOptions Default { get; } = new StorageManagementClientOptions();
422-
422+
423423
public StorageManagementClientOptions(ServiceVersion serviceVersion = Latest)
424424
{
425425
VersionString = serviceVersion switch
@@ -428,9 +428,9 @@ See [Data Plane Quick Start Tutorial](https://github.com/Azure/azure-sdk-for-net
428428
_ => throw new ArgumentOutOfRangeException(nameof(serviceVersion))
429429
};
430430
}
431-
431+
432432
internal string VersionString { get; }
433-
433+
434434
public enum ServiceVersion
435435
{
436436
#pragma warning disable CA1707 // Identifiers should not contain underscores
@@ -449,7 +449,7 @@ See [Data Plane Quick Start Tutorial](https://github.com/Azure/azure-sdk-for-net
449449
public FileSharesClient(string subscriptionId, TokenCredential tokenCredential): this(subscriptionId, tokenCredential, StorageManagementClientOptions.Default)
450450
{
451451
}
452-
452+
453453
public FileSharesClient(string subscriptionId, TokenCredential tokenCredential, StorageManagementClientOptions options):
454454
this(new ClientDiagnostics(options), ManagementClientPipeline.Build(options, tokenCredential), subscriptionId, apiVersion: options.VersionString)
455455
{
@@ -520,8 +520,8 @@ Once all of the above steps are met, the following process will be followed:
520520

521521
| | Linux (Ubuntu 20.04) | MacOS 10.15 | Windows Server 2019 |
522522
| ------------------------ | :------------------: | :---------: | :-----------------: |
523-
| **.NET 6** | x | x | x |
524-
| **.NET Core 3.1** | x | x | x |
523+
| **.NET 7.0** | x | x | x |
524+
| **.NET 6.0** | x | x | x |
525525
| **.NET Framework 4.6.1** | | | x |
526526

527527
### Issues with Generated Code

common/SmokeTests/SmokeTest/SmokeTest.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<OutputType>Exe</OutputType>
4-
<TargetFrameworks>netcoreapp3.1;net461;net6.0</TargetFrameworks>
4+
<TargetFrameworks>net7.0;net6.0;net461</TargetFrameworks>
55
<LangVersion>latest</LangVersion>
66
<NoWarn>$(NoWarn);NU1605</NoWarn>
77
</PropertyGroup>
@@ -38,7 +38,7 @@
3838
<PackageReference Include="System.Net.NameResolution" Version="4.3.0" />
3939
</ItemGroup>
4040

41-
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.1'">
41+
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp3.1'))">
4242
<!-- This package supports netcoreapp3.1 -->
4343
<PackageReference Remove="Microsoft.Azure.WebPubSub.AspNetCore" />
4444
</ItemGroup>

doc/ApiDocGeneration/assets/docgen.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
3+
<TargetFrameworks>net6.0</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>

doc/dev/Using-Mock-Test-Generation.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Below is a sample for mock testcase:
2121

2222
<div id="generate-mock-test"/>
2323

24-
# Generate Mock Test
24+
# Generate Mock Test
2525
The Mgmt mock tests can be generated by below steps:
2626

2727
1. Go to folder Azure.ResourceManager.xxx\tests
@@ -56,7 +56,7 @@ The Mgmt mock tests can be generated by below steps:
5656
[USE autorest]
5757
~~~
5858
// clone autorest.csharp and build
59-
> autorest --use=PATH_TO_AUTOREST.CSHARP\artifacts\bin\AutoRest.CSharp\Debug\netcoreapp3.1 autorest.tests.md --testmodeler={} --debug
59+
> autorest --use=PATH_TO_AUTOREST.CSHARP\artifacts\bin\AutoRest.CSharp\Debug\net6.0 autorest.tests.md --testmodeler={} --debug
6060
~~~
6161
6262
[or USE dotnet target]

eng/Directory.Build.Common.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
<PropertyGroup Condition="'$(IsTestProject)' == 'true' or '$(IsTestSupportProject)' == 'true' or '$(IsSamplesProject)' == 'true' or '$(IsPerfProject)' == 'true' or '$(IsStressProject)' == 'true'">
124124
<IsPackable>false</IsPackable>
125125
<!-- List newest targets first so that recordings are made with latest, running tests from editor runs latest, etc. -->
126-
<RequiredTargetFrameworks>net6.0;netcoreapp3.1</RequiredTargetFrameworks>
126+
<RequiredTargetFrameworks>net7.0;net6.0</RequiredTargetFrameworks>
127127
<!-- Also test net461 on Windows. -->
128128
<RequiredTargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(RequiredTargetFrameworks);net461</RequiredTargetFrameworks>
129129
</PropertyGroup>

eng/mgmt/AzSdk.test.reference.props

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup>
3-
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
3+
<TargetFrameworks>net6.0</TargetFrameworks>
44
</PropertyGroup>
55
<ItemGroup>
66
<ProjectReference Include="$(RepoEngPath)\..\sdk\mgmtcommon\TestFramework\Microsoft.Azure.Test.HttpRecorder\Microsoft.Azure.Test.HttpRecorder.csproj" />
@@ -14,7 +14,7 @@
1414
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
1515
</ItemGroup>
1616

17-
<ItemGroup>
18-
<Compile Include="$(RepoEngPath)\mgmt\DisableTestRunParallel.cs" Link="DisableTestRunParallel.cs" />
17+
<ItemGroup>
18+
<Compile Include="$(RepoEngPath)\mgmt\DisableTestRunParallel.cs" Link="DisableTestRunParallel.cs" />
1919
</ItemGroup>
2020
</Project>

eng/pipelines/templates/jobs/smoke.tests.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,22 @@ jobs:
4747
condition: and(succeeded(), eq(dependencies.smoke_test_eligibility.outputs['output_eligibility.RunSmokeTests'], true))
4848
strategy:
4949
matrix:
50+
Ubuntu_Net60:
51+
Pool: "azsdk-pool-mms-ubuntu-2004-general"
52+
OSVmImage: "MMSUbuntu20.04"
53+
TestTargetFramework: net6.0
5054
Windows_NetFramework:
5155
Pool: "azsdk-pool-mms-win-2022-general"
5256
OSVmImage: "MMS2022"
5357
TestTargetFramework: net461
54-
Windows_NetCore:
55-
Pool: "azsdk-pool-mms-ubuntu-2004-general"
56-
OSVmImage: "MMSUbuntu20.04"
57-
TestTargetFramework: netcoreapp3.1
5858
Windows_Net60:
5959
Pool: "azsdk-pool-mms-win-2022-general"
6060
OSVmImage: "MMS2022"
6161
TestTargetFramework: net6.0
62+
Windows_Net70:
63+
Pool: "azsdk-pool-mms-win-2022-general"
64+
OSVmImage: "MMS2022"
65+
TestTargetFramework: net7.0
6266
pool:
6367
name: $(Pool)
6468
vmImage: $(OSVmImage)

eng/pipelines/templates/stages/platform-matrix.json

+15-15
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,35 @@
55
},
66
"matrix": {
77
"Agent": {
8-
"Ubuntu-20.04_NETCore3.1": {
8+
"Ubuntu-20.04_NET6.0": {
99
"OSVmImage": "MMSUbuntu20.04",
1010
"Pool": "azsdk-pool-mms-ubuntu-2004-general",
11-
"TestTargetFramework": "netcoreapp3.1"
11+
"TestTargetFramework": "net6.0"
1212
},
13-
"Ubuntu-20.04_NET6.0": {
13+
"Ubuntu-20.04_NET7.0": {
1414
"OSVmImage": "MMSUbuntu20.04",
1515
"Pool": "azsdk-pool-mms-ubuntu-2004-general",
16-
"TestTargetFramework": "net6.0"
16+
"TestTargetFramework": "net7.0"
1717
},
18-
"windows2022_NET6.0": {
18+
"Windows2022_NET461": {
1919
"OSVmImage": "MMS2022",
2020
"Pool": "azsdk-pool-mms-win-2022-general",
21-
"TestTargetFramework": "net6.0"
21+
"TestTargetFramework": "net461"
2222
},
23-
"windows2022_NET461": {
23+
"Windows2022_NET7.0": {
2424
"OSVmImage": "MMS2022",
2525
"Pool": "azsdk-pool-mms-win-2022-general",
26-
"TestTargetFramework": "net461"
26+
"TestTargetFramework": "net7.0"
2727
},
28-
"macos-11_NETCore3.1": {
28+
"MacOS-11_NET6.0": {
2929
"OSVmImage": "macos-11",
3030
"Pool": "Azure Pipelines",
31-
"TestTargetFramework": "netcoreapp3.1"
31+
"TestTargetFramework": "net6.0"
3232
},
33-
"macos-11_NET6.0": {
33+
"MacOS-11_NET7.0": {
3434
"OSVmImage": "macos-11",
3535
"Pool": "Azure Pipelines",
36-
"TestTargetFramework": "net6.0"
36+
"TestTargetFramework": "net7.0"
3737
}
3838
},
3939
"AdditionalTestArguments": [
@@ -48,14 +48,14 @@
4848
"include": [
4949
{
5050
"Agent": {
51-
"windows2022": {
51+
"Windows2022_NET7.0": {
5252
"OSVmImage": "MMS2022",
5353
"Pool": "azsdk-pool-mms-win-2022-general",
54-
"TestTargetFramework": "net6.0"
54+
"TestTargetFramework": "net7.0"
5555
}
5656
},
5757
"TestMode": {
58-
"NET6.0_Coverage_Record": {
58+
"Coverage_Record": {
5959
"SupportsRecording": true,
6060
"CollectCoverage": true
6161
}

eng/pipelines/templates/steps/install-dotnet.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,20 @@ steps:
1212
msbuildArguments: /p:WorkFolder="$(Agent.WorkFolder)" /p:BuildDirectory="$(Agent.BuildDirectory)"
1313
# Installation steps need to be uncommented when switching to a newer SDK that's not available on DevOps agents
1414
- task: UseDotNet@2
15-
displayName: 'Use .NET Core SDK'
15+
displayName: 'Use .NET SDK'
1616
retryCountOnTaskFailure: 3
1717
inputs:
1818
useGlobalJson: true
1919
performMultiLevelLookup: true
20+
- task: UseDotNet@2
21+
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) # Windows supports MultiLevelLookup and doesn't need explicit framework installation
22+
displayName: 'Use .NET 6.0 SDK'
23+
retryCountOnTaskFailure: 3
24+
inputs:
25+
# AspNetCore runtime pack can't be installed outside of SDK and we need it for integration tests
26+
packageType: sdk
27+
performMultiLevelLookup: true
28+
version: "6.0.x"
2029
- task: UseDotNet@2
2130
condition: and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT')) # Windows supports MultiLevelLookup and doesn't need explicit framework installation
2231
displayName: 'Use .NET Core 3.1 SDK'

eng/scripts/dependencies/azure-sdk.deps.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp3.1</TargetFramework>
3+
<TargetFramework>net6.0</TargetFramework>
44
<OutputType>Exe</OutputType>
55
<EnableDefaultItems>false</EnableDefaultItems>
6-
<!--
7-
Loading a dev version of some dependencies causes some downgrade warnings.
8-
This can happen sometimes after releaseing a new version when the version in
6+
<!--
7+
Loading a dev version of some dependencies causes some downgrade warnings.
8+
This can happen sometimes after releaseing a new version when the version in
99
the repo has not yet been updated.
1010
-->
1111
<NoWarn>$(NoWarn);NU1605</NoWarn>

global.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"Microsoft.Build.Traversal": "3.2.0"
44
},
55
"sdk": {
6-
"version": "6.0.403",
6+
"version": "7.0.101",
77
"rollForward": "feature"
88
}
9-
}
9+
}

samples/AppSecretsConfig/AppSecretsConfig.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<RootNamespace>AppSecretsConfig</RootNamespace>
66
</PropertyGroup>
77

samples/CloudClipboard/CloudClipboard/CloudClipboard.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
55
<LangVersion>preview</LangVersion>
66
</PropertyGroup>
77

samples/linecounter/LineCounter.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp3.1</TargetFramework>
3+
<TargetFramework>net6.0</TargetFramework>
44
<UserSecretsId>67ca5d37-051b-4ab1-b013-c74a2d4edb76</UserSecretsId>
55
</PropertyGroup>
66
<ItemGroup>

sdk/appconfiguration/CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ Before working on a contribution, it would be beneficial to familiarize yourself
2222

2323
These libraries follow the [Azure SDK Design Guidelines for .NET][sdk_design_guidelines_dotnet] and share a number of core features such as HTTP retries, logging, transport protocols, authentication protocols, etc., so that once you learn how to use these features in one client library, you will know how to use them in other client libraries. You can learn about these shared features in the [Azure.Core README][sdk_dotnet_code_readme].
2424

25-
## Public API changes
25+
## Public API changes
2626

27-
To update [`Azure.Data.AppConfiguration.netstandard2.0.cs`][azconfig_api] after making changes to the public API, execute [`./eng/scripts/Export-API.ps1`][azconfig_export_api].
27+
To update [`Azure.Data.AppConfiguration.netstandard2.0.cs`][azconfig_api] after making changes to the public API, execute [`./eng/scripts/Export-API.ps1`][azconfig_export_api].
2828

2929
## Testing
3030

@@ -48,7 +48,7 @@ Properly supporting recorded tests does require a few extra considerations. All
4848

4949
The easiest way to run the tests is via Visual Studio's unit test runner.
5050

51-
You can also run tests via the command line using `dotnet test`, but that will run tests for all supported platforms simultaneously and intermingle their output. You can run the tests for just one platform with `dotnet test -f netcoreapp3.1` or `dotnet test -f net461`.
51+
You can also run tests via the command line using `dotnet test`, but that will run tests for all supported platforms simultaneously and intermingle their output. You can run the tests for just one platform with `dotnet test -f net6.0` or `dotnet test -f net461`.
5252

5353
The recorded tests are run automatically on every pull request. Live tests are run nightly. Contributors with write access can ask Azure DevOps to run the live tests against a pull request by commenting `/azp run net - appconfiguration - tests` in the PR.
5454

0 commit comments

Comments
 (0)