Skip to content

Commit 3d822a3

Browse files
committed
Add net7.0 target.
Replace net5.0 (out of support) with net7.0 in build and tests.
1 parent f8a0a40 commit 3d822a3

File tree

8 files changed

+20
-27
lines changed

8 files changed

+20
-27
lines changed

.ci/build-steps.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,16 @@ steps:
5959
targetPath: 'tests/SideBySide/bin/Release/netcoreapp3.1/publish'
6060

6161
- task: DotNetCoreCLI@2
62-
displayName: 'Publish SideBySide (5.0)'
62+
displayName: 'Publish SideBySide (7.0)'
6363
inputs:
6464
command: 'publish'
65-
arguments: '-c Release -f net5.0 --no-build tests/SideBySide/SideBySide.csproj'
65+
arguments: '-c Release -f net7.0 --no-build tests/SideBySide/SideBySide.csproj'
6666
publishWebProjects: false
6767
zipAfterPublish: false
6868
- task: PublishPipelineArtifact@0
6969
inputs:
70-
artifactName: 'SideBySide-net5.0-$(Agent.OS)'
71-
targetPath: 'tests/SideBySide/bin/Release/net5.0/publish'
70+
artifactName: 'SideBySide-net7.0-$(Agent.OS)'
71+
targetPath: 'tests/SideBySide/bin/Release/net7.0/publish'
7272

7373
- task: DotNetCoreCLI@2
7474
displayName: 'Publish SideBySide (6.0)'

.ci/integration-tests-steps.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ steps:
1111
inputs:
1212
version: 3.1.x
1313
packageType: runtime
14-
- task: UseDotNet@2
15-
displayName: 'Install .NET Core 5.0'
16-
inputs:
17-
version: '5.0.x'
18-
packageType: runtime
1914
- task: UseDotNet@2
2015
displayName: 'Install .NET Core 6.0'
2116
inputs:
@@ -41,7 +36,7 @@ steps:
4136
image: ${{ parameters.image }}
4237
unsupportedFeatures: ${{ parameters.unsupportedFeatures }}
4338
connectionString: 'server=localhost;port=3300;user id=mysqltest;password=test;database=mysqltest;ssl mode=required;DefaultCommandTimeout=3600;certificate file=$(Build.Repository.LocalPath)/.ci/server/certs/ssl-client.pfx'
44-
platform: 'net5.0'
39+
platform: 'net7.0'
4540
description: 'SSL'
4641
- template: 'sidebyside-test-steps.yml'
4742
parameters:

azure-pipelines.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ jobs:
4040
sourceFolder: '.ci/config'
4141
contents: 'config.json'
4242
targetFolder: 'tests/SideBySide'
43-
- task: UseDotNet@2
44-
displayName: 'Install .NET Core 5.0'
45-
inputs:
46-
version: '5.0.x'
4743
- task: UseDotNet@2
4844
displayName: 'Install .NET Core 6.0'
4945
inputs:
@@ -146,11 +142,6 @@ jobs:
146142
vmimage: 'windows-2019'
147143
steps:
148144
- template: '.ci/install-mysql-windows.yml'
149-
- task: UseDotNet@2
150-
displayName: 'Install .NET Core 5.0'
151-
inputs:
152-
version: '5.0.x'
153-
packageType: runtime
154145
- task: UseDotNet@2
155146
displayName: 'Install .NET Core'
156147
inputs:
@@ -165,18 +156,18 @@ jobs:
165156
displayName: 'Remove target frameworks'
166157
inputs:
167158
targetType: 'inline'
168-
script: '((Get-Content .\tests\SideBySide\SideBySide.csproj -Raw) -replace(''<TargetFrameworks>.*</TargetFrameworks>'', ''<TargetFrameworks>net472;net5.0</TargetFrameworks>'')) | Set-Content .\tests\SideBySide\SideBySide.csproj'
159+
script: '((Get-Content .\tests\SideBySide\SideBySide.csproj -Raw) -replace(''<TargetFrameworks>.*</TargetFrameworks>'', ''<TargetFrameworks>net472;net7.0</TargetFrameworks>'')) | Set-Content .\tests\SideBySide\SideBySide.csproj'
169160
- task: DotNetCoreCLI@2
170161
displayName: 'Restore packages'
171162
inputs:
172163
command: 'restore'
173164
- task: DotNetCoreCLI@2
174-
displayName: 'Side by Side tests (net472/net5.0)'
165+
displayName: 'Side by Side tests (net472/net7.0)'
175166
inputs:
176167
command: 'test'
177168
projects: 'tests/SideBySide/SideBySide.csproj'
178169
arguments: '-c Release --no-restore'
179-
testRunTitle: ${{ format('{0}, $(Agent.OS), {1}, {2}', 'mysql:8.0', 'net472/net5.0', 'No SSL') }}
170+
testRunTitle: ${{ format('{0}, $(Agent.OS), {1}, {2}', 'mysql:8.0', 'net472/net7.0', 'No SSL') }}
180171
env:
181172
DATA__UNSUPPORTEDFEATURES: 'Ed25519,QueryAttributes,Tls11,UnixDomainSocket'
182173
DATA__CONNECTIONSTRING: 'server=localhost;port=3306;user id=mysqltest;password=test;database=mysqltest;ssl mode=none;DefaultCommandTimeout=3600;AllowPublicKeyRetrieval=True;UseCompression=True'

src/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2121
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2222
<GenerateDocumentationFile>true</GenerateDocumentationFile>
23-
<NoWarn>$(NoWarn);1591;CA1708;CA1835;CA2215;CA5397;NU5105</NoWarn>
23+
<NoWarn>$(NoWarn);1591;CA1708;CA1835;CA2215;CA5397;NU5105;SYSLIB0039</NoWarn>
2424
<MinVerDefaultPreReleasePhase>beta</MinVerDefaultPreReleasePhase>
2525
</PropertyGroup>
2626

src/MySqlConnector/Core/TypeMapper.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,12 @@ private TypeMapper()
107107
AddColumnTypeMetadata(new("YEAR", typeInt, MySqlDbType.Year));
108108

109109
// guid
110-
var typeGuid = AddDbTypeMapping(new(typeof(Guid), new[] { DbType.Guid }, convert: static o => Guid.Parse(Convert.ToString(o, CultureInfo.InvariantCulture)!)));
110+
#if NET7_0_OR_GREATER
111+
Func<object, object> convertGuid = static o => Guid.Parse(Convert.ToString(o, CultureInfo.InvariantCulture)!, CultureInfo.InvariantCulture);
112+
#else
113+
Func<object, object> convertGuid = static o => Guid.Parse(Convert.ToString(o, CultureInfo.InvariantCulture)!);
114+
#endif
115+
var typeGuid = AddDbTypeMapping(new(typeof(Guid), new[] { DbType.Guid }, convert: convertGuid));
111116
AddColumnTypeMetadata(new("CHAR", typeGuid, MySqlDbType.Guid, length: 36, simpleDataTypeName: "CHAR(36)", createFormat: "CHAR(36)"));
112117

113118
// null

src/MySqlConnector/MySqlConnector.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net45;net461;net471;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
4+
<TargetFrameworks>net45;net461;net471;netstandard2.0;netstandard2.1;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
55
<Description>A truly async MySQL ADO.NET provider, supporting MySQL Server, MariaDB, Percona Server, Amazon Aurora, Azure Database for MySQL and more.</Description>
66
<Copyright>Copyright 2016–2022 Bradley Grainger</Copyright>
77
<Authors>Bradley Grainger</Authors>

tests/SideBySide/SideBySide.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup Condition=" '$(Configuration)' != 'Baseline' ">
4-
<TargetFrameworks>net452;net461;net472;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
4+
<TargetFrameworks>net452;net461;net472;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
55
<CheckEolTargetFramework>false</CheckEolTargetFramework>
66
</PropertyGroup>
77

tests/SideBySide/SslTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,13 @@ public async Task ConnectSslTlsVersion()
218218
{
219219
using var connection = new MySqlConnection(AppConfig.ConnectionString);
220220
await connection.OpenAsync();
221+
#pragma warning disable SYSLIB0039 // SslProtocols.Tls11 is obsolete
221222
var expectedProtocol = AppConfig.SupportedFeatures.HasFlag(ServerFeatures.Tls12) ? SslProtocols.Tls12 :
222223
AppConfig.SupportedFeatures.HasFlag(ServerFeatures.Tls11) ? SslProtocols.Tls11 :
223224
SslProtocols.Tls;
224225
var expectedProtocolString = expectedProtocol == SslProtocols.Tls12 ? "TLSv1.2" :
225226
expectedProtocol == SslProtocols.Tls11 ? "TLSv1.1" : "TLSv1";
227+
#pragma warning restore SYSLIB0039 // SslProtocols.Tls11 is obsolete
226228

227229
#if !NET452 && !NET461 && !NET472
228230
// https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#tls-13--openssl-111-on-linux
@@ -242,7 +244,7 @@ public async Task ConnectSslTlsVersion()
242244
Assert.Equal(expectedProtocolString, reader.GetString(1));
243245
}
244246

245-
#if !NET5_0
247+
#if !NET5_0_OR_GREATER
246248
[SkippableFact(ConfigSettings.RequiresSsl)]
247249
public async Task ForceTls11()
248250
{

0 commit comments

Comments
 (0)