升级net10编译成功

This commit is contained in:
ChenYi 2026-01-15 17:30:47 +08:00
parent 0db946724c
commit 8da8fb14ca
16 changed files with 83 additions and 100 deletions

70
.gitignore vendored
View File

@ -3,58 +3,58 @@
################################################################################
/.vs
/gateways/JiShe.IoT.WebGateway/bin/Debug/net9.0
/gateways/JiShe.IoT.WebGateway/bin/Debug/net10.0
/gateways/JiShe.IoT.WebGateway/obj
/host/JiShe.IoT.HttpApi.Host/bin/Debug/net9.0
/host/JiShe.IoT.HttpApi.Host/bin/Debug/net10.0
/host/JiShe.IoT.HttpApi.Host/Logs
/host/JiShe.IoT.HttpApi.Host/obj
/src/JiShe.IoT.Application/bin/Debug/net9.0
/src/JiShe.IoT.Application/obj/Debug/net9.0
/src/JiShe.IoT.Application.Contracts/bin/Debug/net9.0
/src/JiShe.IoT.Application.Contracts/obj/Debug/net9.0
/src/JiShe.IoT.DbMigrator/bin/Debug/net9.0
/src/JiShe.IoT.Application/bin/Debug/net10.0
/src/JiShe.IoT.Application/obj/Debug/net10.0
/src/JiShe.IoT.Application.Contracts/bin/Debug/net10.0
/src/JiShe.IoT.Application.Contracts/obj/Debug/net10.0
/src/JiShe.IoT.DbMigrator/bin/Debug/net10.0
/src/JiShe.IoT.DbMigrator/obj
/src/JiShe.IoT.Domain/bin/Debug/net9.0
/src/JiShe.IoT.Domain/bin/Debug/net10.0
/src/JiShe.IoT.Domain/obj
/src/JiShe.IoT.Domain.Shared/bin/Debug/net9.0
/src/JiShe.IoT.Domain.Shared/obj/Debug/net9.0
/src/JiShe.IoT.EntityFrameworkCore/bin/Debug/net9.0
/src/JiShe.IoT.Domain.Shared/bin/Debug/net10.0
/src/JiShe.IoT.Domain.Shared/obj/Debug/net10.0
/src/JiShe.IoT.EntityFrameworkCore/bin/Debug/net10.0
/src/JiShe.IoT.EntityFrameworkCore/obj
/src/JiShe.IoT.FreeSqlRepository/bin/Debug/net9.0
/src/JiShe.IoT.FreeSqlRepository/bin/Debug/net10.0
/src/JiShe.IoT.FreeSqlRepository/obj
/src/JiShe.IoT.HttpApi/bin/Debug/net9.0
/src/JiShe.IoT.HttpApi/bin/Debug/net10.0
/src/JiShe.IoT.HttpApi/obj
/src/JiShe.IoT.HttpApi.Client/bin/Debug/net9.0
/src/JiShe.IoT.HttpApi.Client/bin/Debug/net10.0
/src/JiShe.IoT.HttpApi.Client/obj
/test/JiShe.IoT.Application.Tests/bin/Debug/net9.0
/test/JiShe.IoT.Application.Tests/bin/Debug/net10.0
/test/JiShe.IoT.Application.Tests/obj
/test/JiShe.IoT.Domain.Tests/bin/Debug/net9.0
/test/JiShe.IoT.Domain.Tests/bin/Debug/net10.0
/test/JiShe.IoT.Domain.Tests/obj
/test/JiShe.IoT.EntityFrameworkCore.Tests/bin/Debug/net9.0
/test/JiShe.IoT.EntityFrameworkCore.Tests/bin/Debug/net10.0
/test/JiShe.IoT.EntityFrameworkCore.Tests/obj
/test/JiShe.IoT.HttpApi.Client.ConsoleTestApp/bin/Debug/net9.0
/test/JiShe.IoT.HttpApi.Client.ConsoleTestApp/bin/Debug/net10.0
/test/JiShe.IoT.HttpApi.Client.ConsoleTestApp/obj
/test/JiShe.IoT.TestBase/bin/Debug/net9.0
/test/JiShe.IoT.TestBase/bin/Debug/net10.0
/test/JiShe.IoT.TestBase/obj
/src/JiShe.IoT.Application/obj
/src/JiShe.IoT.Application.Contracts/obj
/src/JiShe.IoT.Domain.Shared/obj
/src/JiShe.IoT.Application/bin/Release/net9.0
/src/JiShe.IoT.Application.Contracts/bin/Release/net9.0
/src/JiShe.IoT.Domain/bin/Release/net9.0
/src/JiShe.IoT.Domain.Shared/bin/Release/net9.0
/src/JiShe.IoT.EntityFrameworkCore/bin/Release/net9.0
/src/JiShe.IoT.HttpApi/bin/Release/net9.0
/gateways/JiShe.IoT.WebGateway/bin/Release/net9.0
/host/JiShe.IoT.HttpApi.Host/bin/Release/net9.0
/host/JiShe.IoT.HttpApi.Host/bin/Release/net9.0/ca/Hangfire.Core.resources.dll
/src/JiShe.IoT.DbMigrator/bin/Release/net9.0
/src/JiShe.IoT.HttpApi.Client/bin/Release/net9.0
/test/JiShe.IoT.Application.Tests/bin/Release/net9.0
/test/JiShe.IoT.Domain.Tests/bin/Release/net9.0
/test/JiShe.IoT.EntityFrameworkCore.Tests/bin/Release/net9.0
/test/JiShe.IoT.HttpApi.Client.ConsoleTestApp/bin/Release/net9.0
/test/JiShe.IoT.TestBase/bin/Release/net9.0
/src/JiShe.IoT.Application/bin/Release/net10.0
/src/JiShe.IoT.Application.Contracts/bin/Release/net10.0
/src/JiShe.IoT.Domain/bin/Release/net10.0
/src/JiShe.IoT.Domain.Shared/bin/Release/net10.0
/src/JiShe.IoT.EntityFrameworkCore/bin/Release/net10.0
/src/JiShe.IoT.HttpApi/bin/Release/net10.0
/gateways/JiShe.IoT.WebGateway/bin/Release/net10.0
/host/JiShe.IoT.HttpApi.Host/bin/Release/net10.0
/host/JiShe.IoT.HttpApi.Host/bin/Release/net10.0/ca/Hangfire.Core.resources.dll
/src/JiShe.IoT.DbMigrator/bin/Release/net10.0
/src/JiShe.IoT.HttpApi.Client/bin/Release/net10.0
/test/JiShe.IoT.Application.Tests/bin/Release/net10.0
/test/JiShe.IoT.Domain.Tests/bin/Release/net10.0
/test/JiShe.IoT.EntityFrameworkCore.Tests/bin/Release/net10.0
/test/JiShe.IoT.HttpApi.Client.ConsoleTestApp/bin/Release/net10.0
/test/JiShe.IoT.TestBase/bin/Release/net10.0
/host/JiShe.IoT.HttpApi.Host/UploadFile/20250729/host/abp-file-management
/host/JiShe.IoT.HttpApi.Host/UploadFile/20250731/host/abp-file-management/3a1b7059-f930-8a33-5a5b-a67f48f2feec
/gateways/JiShe.IoT.WebGateway/bin/Debug/net10.0

View File

@ -20,11 +20,11 @@
<PackageReference Update="Microsoft.AspNetCore.Mvc.Core" Version="2.3.0"/>
<PackageReference Update="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0"/>
<PackageReference Update="Microsoft.AspNetCore.Http.Features" Version="2.3.0"/>
<PackageReference Update="Microsoft.CSharp" Version="4.14.0"/>
<PackageReference Update="Microsoft.CSharp" Version="5.0.0"/>
<PackageReference Update="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="4.14.0" />
<PackageReference Update="Microsoft.CodeAnalysis.Common " Version="4.14.0" />
<PackageReference Update="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.14.0" />
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
<PackageReference Update="Microsoft.CodeAnalysis.Common " Version="5.0.0" />
<PackageReference Update="Microsoft.CodeAnalysis.Workspaces.Common" Version="5.0.0" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
</ItemGroup>
</Project>

View File

@ -4,12 +4,12 @@
<!--JiShe.ServicePro版本-->
<ServiceProVersion>1.0.5.40</ServiceProVersion>
<!--Volo Abp 版本-->
<VoloAbpVersion>9.3.4</VoloAbpVersion>
<VoloAbpVersion>10.0.2</VoloAbpVersion>
<!--Dotnet 组件 版本-->
<DotnetInfoVersion>9.0.11</DotnetInfoVersion>
<DotnetInfoVersion>10.0.2</DotnetInfoVersion>
<!--Dotnet 框架 版本-->
<DotnetTargetFrameworkVersion>net9.0</DotnetTargetFrameworkVersion>
<DotnetTargetFrameworkVersion>net10.0</DotnetTargetFrameworkVersion>
</PropertyGroup>
</Project>

View File

@ -63,9 +63,9 @@
<PackageReference Update="Savorboard.CAP.InMemoryMessageQueue" Version="8.2.1"/>
<!-- Swagger-->
<PackageReference Update="Swashbuckle.AspNetCore.SwaggerUI" Version="9.0.0"/>
<PackageReference Update="Swashbuckle.AspNetCore" Version="9.0.0"/>
<PackageReference Update="Swashbuckle.AspNetCore.Annotations" Version="9.0.0"/>
<PackageReference Update="Swashbuckle.AspNetCore.SwaggerUI" Version="10.0.1"/>
<PackageReference Update="Swashbuckle.AspNetCore" Version="10.0.1"/>
<PackageReference Update="Swashbuckle.AspNetCore.Annotations" Version="10.0.1"/>
<!-- Serilog 日志-->
<PackageReference Update="Serilog" Version="4.3.0"/>

View File

@ -36,7 +36,7 @@ global using Microsoft.Extensions.Logging;
global using Microsoft.Extensions.Logging.Abstractions;
global using Microsoft.Extensions.Options;
global using Microsoft.IdentityModel.Tokens;
global using Microsoft.OpenApi.Models;
global using Microsoft.OpenApi;
global using JiShe.IoT;
global using Serilog;
global using StackExchange.Redis;

View File

@ -50,10 +50,10 @@ public partial class IoTHttpApiHostModule
private void ConfigureJwtAuthentication(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(options =>
{
options.TokenValidationParameters =
@ -148,13 +148,16 @@ public partial class IoTHttpApiHostModule
context.Services.AddSwaggerGen(
options =>
{
// 隐藏ABP默认的端点
options.HideAbpEndpoints();
// 文件下载类型
options.MapType<FileContentResult>(() => new OpenApiSchema() { Type = "file" });
options.MapType<FileContentResult>(() => new OpenApiSchema() { Type = JsonSchemaType.String, Format = "binary" });
options.SwaggerDoc("AbpPro", new OpenApiInfo { Title = "AbpPro API", Version = "v1" });
var configuration = context.Services.GetConfiguration();
var groupNames = EnumExtensions.GetEnumTypeValueNameList<SwaggerGroupEnum>();
var groupNames = System.EnumExtensions.GetEnumTypeValueNameList<SwaggerGroupEnum>();
var excludeSwaggerGroups = configuration.GetSection("ExcludeSwaggerGroup").Get<List<string>>() ?? new List<string>();
groupNames.ForEach(group =>
@ -207,18 +210,12 @@ public partial class IoTHttpApiHostModule
Scheme = JwtBearerDefaults.AuthenticationScheme,
BearerFormat = "JWT"
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement
options.AddSecurityRequirement(document => new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{
Type = ReferenceType.SecurityScheme, Id = "Bearer"
}
},
new List<string>()
}
{
new OpenApiSecuritySchemeReference(JwtBearerDefaults.AuthenticationScheme, document),
new List<string>()
}
});
options.AddSecurityDefinition("ApiKey", new OpenApiSecurityScheme()
@ -229,15 +226,11 @@ public partial class IoTHttpApiHostModule
Description = "多语言设置系统预设语言有zh-Hans、en默认为zh-Hans",
});
options.AddSecurityRequirement(new OpenApiSecurityRequirement
options.AddSecurityRequirement(document => new OpenApiSecurityRequirement
{
{
new OpenApiSecurityScheme
{
Reference = new OpenApiReference
{ Type = ReferenceType.SecurityScheme, Id = "ApiKey" }
},
Array.Empty<string>()
new OpenApiSecuritySchemeReference("ApiKey", document),
new List<string>()
}
});
});

View File

@ -7,6 +7,7 @@ using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.Unicode;
using Volo.Abp.BlobStoring.FileSystem;
using Volo.Abp.Swashbuckle;
namespace JiShe.IoT
{
@ -19,12 +20,12 @@ namespace JiShe.IoT
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpAccountWebModule),
typeof(IoTApplicationModule),
// typeof(AbpProCapModule),
// typeof(AbpProCapEntityFrameworkCoreModule),
typeof(AbpAspNetCoreMvcModule),
typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpBlobStoringFileSystemModule),
typeof(AbpDistributedLockingModule)
typeof(AbpDistributedLockingModule),
typeof(AbpSwashbuckleModule)
//typeof(AbpBackgroundJobsHangfireModule)
)]
public partial class IoTHttpApiHostModule : AbpModule
@ -88,7 +89,7 @@ namespace JiShe.IoT
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
var groupNames = EnumExtensions.GetEnumTypeValueNameList<SwaggerGroupEnum>();
var groupNames = System.EnumExtensions.GetEnumTypeValueNameList<SwaggerGroupEnum>();
var excludeSwaggerGroups = configuration.GetSection("ExcludeSwaggerGroup").Get<List<string>>() ?? new List<string>();
groupNames.ForEach(attr =>
{

View File

@ -33,7 +33,6 @@
<PackageReference Include="Serilog.Sinks.File" />
<PackageReference Include="Serilog.Sinks.Async" />
<PackageReference Include="Hangfire.Redis.StackExchange" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" />
<PackageReference Include="MiniProfiler.AspNetCore.Mvc" />
<PackageReference Include="DotNetCore.CAP.MySql" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" />

View File

@ -53,15 +53,9 @@ public class Program
await app.RunAsync();
return 0;
}
catch (Exception ex)
catch (Exception)
{
if (ex is HostAbortedException)
{
throw;
}
Log.Fatal(ex, "Host terminated unexpectedly!");
return 1;
throw;
}
finally
{

View File

@ -42,7 +42,7 @@ namespace JiShe.IoT.Data
await MigrateDatabaseSchemaAsync();
await SeedDataAsync();
//await InitIoTDBTable();
await InitIoTDBTable();
Logger.LogInformation($"Successfully completed host database migrations.");

View File

@ -90,7 +90,6 @@ namespace JiShe.IoT.EntityFrameworkCore
public DbSet<OneNETProductInfos> OneNETProductInfo { get; set; }
public IoTDbContext(DbContextOptions<IoTDbContext> options)
: base(options)
{

View File

@ -58,10 +58,7 @@ namespace JiShe.IoT.EntityFrameworkCore
* See also HayoonKoreaDbContextFactory for EF Core tooling.
* https://github.com/abpframework/abp/issues/21879
* */
options.UseNpgsql(builder =>
{
builder.TranslateParameterizedCollectionsToConstants();
});
options.UseNpgsql();
});
}
}

View File

@ -7,9 +7,9 @@
<ItemGroup>
<ProjectReference Include="..\JiShe.IoT.Domain\JiShe.IoT.Domain.csproj" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.PostgreSql" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.14.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.14.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="5.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="5.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="5.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Debug'" Label="Debug">

View File

@ -13,7 +13,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace JiShe.IoT.Migrations
{
[DbContext(typeof(IoTDbContext))]
[Migration("20260115061417_InitialCreate")]
[Migration("20260115084844_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
@ -22,7 +22,7 @@ namespace JiShe.IoT.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.PostgreSql)
.HasAnnotation("ProductVersion", "9.0.11")
.HasAnnotation("ProductVersion", "10.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@ -3361,8 +3361,8 @@ namespace JiShe.IoT.Migrations
.HasColumnType("character varying(64)");
b.Property<string>("DeviceInfo")
.HasMaxLength(64)
.HasColumnType("character varying(64)");
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("text")

View File

@ -465,7 +465,7 @@ namespace JiShe.IoT.Migrations
Id = table.Column<Guid>(type: "uuid", nullable: false),
SessionId = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
Device = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
DeviceInfo = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
DeviceInfo = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
TenantId = table.Column<Guid>(type: "uuid", nullable: true),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
ClientId = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),

View File

@ -19,7 +19,7 @@ namespace JiShe.IoT.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.PostgreSql)
.HasAnnotation("ProductVersion", "9.0.11")
.HasAnnotation("ProductVersion", "10.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@ -3358,8 +3358,8 @@ namespace JiShe.IoT.Migrations
.HasColumnType("character varying(64)");
b.Property<string>("DeviceInfo")
.HasMaxLength(64)
.HasColumnType("character varying(64)");
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<string>("ExtraProperties")
.HasColumnType("text")