适配net10

This commit is contained in:
2248356998 qq.com
2025-09-28 13:06:39 +08:00
parent 3c9e397403
commit 976323a716
5 changed files with 12 additions and 7 deletions

View File

@@ -35,7 +35,7 @@ public static class PBKDF2Encryption
var salt = new byte[saltSize];
rng.GetBytes(salt);
#if NET10_0_OR_GREATER
var hash = Rfc2898DeriveBytes.Pbkdf2(Encoding.UTF8.GetBytes(text), salt, iterationCount, HashAlgorithmName.SHA256, derivedKeyLength);
var hash = Rfc2898DeriveBytes.Pbkdf2(System.Text.Encoding.UTF8.GetBytes(text), salt, iterationCount, HashAlgorithmName.SHA256, derivedKeyLength);
#else
using var pbkdf2 = new Rfc2898DeriveBytes(text, salt, iterationCount, HashAlgorithmName.SHA256);
var hash = pbkdf2.GetBytes(derivedKeyLength);
@@ -69,7 +69,7 @@ public static class PBKDF2Encryption
return false;
#if NET10_0_OR_GREATER
var computedHash = Rfc2898DeriveBytes.Pbkdf2(Encoding.UTF8.GetBytes(text), saltBytes, iterationCount, HashAlgorithmName.SHA256, derivedKeyLength);
var computedHash = Rfc2898DeriveBytes.Pbkdf2(System.Text.Encoding.UTF8.GetBytes(text), saltBytes, iterationCount, HashAlgorithmName.SHA256, derivedKeyLength);
#else
using var pbkdf2 = new Rfc2898DeriveBytes(text, saltBytes, iterationCount, HashAlgorithmName.SHA256);
var computedHash = pbkdf2.GetBytes(derivedKeyLength);

View File

@@ -1,9 +1,9 @@
<Project>
<PropertyGroup>
<PluginVersion>10.11.76</PluginVersion>
<ProPluginVersion>10.11.76</ProPluginVersion>
<DefaultVersion>10.11.76</DefaultVersion>
<PluginVersion>10.11.77</PluginVersion>
<ProPluginVersion>10.11.77</ProPluginVersion>
<DefaultVersion>10.11.77</DefaultVersion>
<AuthenticationVersion>10.11.6</AuthenticationVersion>
<SourceGeneratorVersion>10.11.6</SourceGeneratorVersion>
<NET8Version>8.0.20</NET8Version>

View File

@@ -14,7 +14,7 @@
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@@ -12,6 +12,11 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
#if NET10_0_OR_GREATER
using Microsoft.Extensions.Hosting;
#endif
using MQTTnet.AspNetCore;
using ThingsGateway.Foundation;

View File

@@ -42,7 +42,7 @@ public partial class MqttServer : BusinessBaseWithCacheIntervalScriptAll
#if NET10_0_OR_GREATER
private IHost _webHost { get; set; }
private Microsoft.Extensions.Hosting.IHost _webHost { get; set; }
#else
private IWebHost _webHost { get; set; }