Skip to content

Commit

Permalink
Merge pull request #740 from mixcore/features/upgrade-net9
Browse files Browse the repository at this point in the history
upgrade net 9
  • Loading branch information
Smilefounder authored Feb 14, 2025
2 parents b6aab07 + 981707d commit bdb0e05
Show file tree
Hide file tree
Showing 836 changed files with 42,885 additions and 119,921 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ FakesAssemblies/
*.opt

azure-pipelines.yml
appsettings.json

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
Expand All @@ -245,11 +244,12 @@ ModelManifest.xml
*.db
src/applications/**/PublishProfiles/
src/applications/**/mixcontent/
src/applications/**/ServiceDependencies/

src/applications/Mixcore/wwwroot/portal-apps/
src/**/__pycache__/
src/**/logs/

src/**/mixcontent/
src/**/*.sqlite-shm
src/**/*.sqlite-wal
src/applications/mixcore/wwwroot/**/*.sqlite
10 changes: 8 additions & 2 deletions src/Mixcore.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31912.275
Expand Down Expand Up @@ -130,6 +129,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution items", "solution
Readme.md = Readme.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "mix.scylladb", "platform\mix.scylladb\mix.scylladb.csproj", "{A15A6930-30D6-46DC-B02B-0015D059A0C8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -292,6 +293,10 @@ Global
{737720EE-DF6F-4457-84D6-45E0E2F209E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{737720EE-DF6F-4457-84D6-45E0E2F209E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{737720EE-DF6F-4457-84D6-45E0E2F209E6}.Release|Any CPU.Build.0 = Release|Any CPU
{A15A6930-30D6-46DC-B02B-0015D059A0C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A15A6930-30D6-46DC-B02B-0015D059A0C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A15A6930-30D6-46DC-B02B-0015D059A0C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A15A6930-30D6-46DC-B02B-0015D059A0C8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -320,7 +325,7 @@ Global
{081A8E1E-B431-4044-B4B7-203BD1E00589} = {84C68A6F-ECE0-467E-91C0-AE63AC4FC4C7}
{E974EBC1-B6C9-4BC0-AFA5-33EB182CB6A6} = {6F925183-31E6-4DEB-BAB1-80F330B9E199}
{5486F6D4-6144-470A-BEB5-270C4D02486B} = {98FE9DF6-4B31-4A0D-A4F9-74196114CD9D}
{C6B46863-6A6E-4BC0-84F6-EF9DCBCA77D1} = {84C68A6F-ECE0-467E-91C0-AE63AC4FC4C7}
{C6B46863-6A6E-4BC0-84F6-EF9DCBCA77D1} = {69169108-92D3-411D-87EB-DF2DD026FE64}
{728EBD5B-266E-4476-9BDC-37D12194AFE2} = {175276C1-45BB-4C30-BB93-4CB2C2D4A60C}
{2D4838F0-251E-4383-9DAD-7FF91B0E0606} = {45077DFB-D35A-4491-993C-2AC4C8AC838E}
{C0A05428-767E-46C5-A31F-0D220E41F7C5} = {38F30F45-7DB6-4097-BA85-788ACCCBC5F2}
Expand Down Expand Up @@ -357,6 +362,7 @@ Global
{A094BEBE-9607-4AE9-A9DB-9BF7BF704F2F} = {4E880812-C336-4EB2-9FED-2E437957F50A}
{4B4B73DD-9014-4609-89A0-3297289157A6} = {7E1C5D8B-58B4-40B1-8BA7-F8F80B76F276}
{737720EE-DF6F-4457-84D6-45E0E2F209E6} = {C93898B7-2001-4C29-9BBE-33A2E61C350A}
{A15A6930-30D6-46DC-B02B-0015D059A0C8} = {69169108-92D3-411D-87EB-DF2DD026FE64}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0143C230-7F40-44B2-8BA3-EF5B92D55848}
Expand Down
40 changes: 15 additions & 25 deletions src/applications/mixcore.gateway/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,21 @@
using Microsoft.Extensions.DependencyInjection.Extensions;
using Mix.Constant.Constants;
using Mix.Database.Entities.Cms;
using Mix.Database.Services.MixGlobalSettings;
using Mix.Heart.Services;
using Mix.Lib.Extensions;
using Mix.Lib.Helpers;
using Mix.Lib.Services;
using Mix.Shared.Services;
using Mix.Shared.Extensions;
using Ocelot.DependencyInjection;
using Ocelot.Middleware;
using System.Reflection;
using System.Text.Encodings.Web;
using System.Text.Unicode;


bool isInit = true;
if (Directory.Exists("../mixcore/mixcontent/shared"))
{
isInit = false;
MixFileHelper.CopyFolder("../mixcore/mixcontent/shared", MixFolders.MixContentSharedFolder);
}

var builder = MixCmsHelper.CreateWebApplicationBuilder(args);
if (builder.Environment.IsDevelopment())
{
builder.AddServiceDefaults();
}
builder.AddServiceDefaults();

builder.WebHost.UseContentRoot(Directory.GetCurrentDirectory());
builder.Configuration.SetBasePath(builder.Environment.ContentRootPath)
Expand All @@ -35,13 +27,13 @@
.AddEnvironmentVariables();
builder.Services.AddOutputCache();
builder.Services.AddControllers();
builder.Services.AddMixServices(Assembly.GetExecutingAssembly(), builder.Configuration);
builder.AddConfigurations();
builder.AddMixServices(Assembly.GetExecutingAssembly());
builder.Services.AddMixAuthorize<MixCmsContext>(builder.Configuration);
builder.Services.AddScoped<MixIdentityService>();
builder.Services.TryAddSingleton<MixEndpointService>();
builder.Services.AddOcelot(builder.Configuration);
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
if (!builder.Environment.IsDevelopment())
if (!builder.Environment.IsLocal())
{
builder.Services.AddEndpointsApiExplorer();
}
Expand All @@ -59,22 +51,20 @@
}
else
{
builder.Services.AddMixCors();
builder.AddMixCors();
}

var app = builder.Build();
app.MapDefaultEndpoints();

Configure(app, builder.Environment, isInit);
Configure(app, builder.Environment, builder.Configuration);

app.UseOutputCache();
if (app.Environment.IsDevelopment())
{
app.MapDefaultEndpoints();
}
app.MapDefaultEndpoints();
app.Run();

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
static void Configure(WebApplication app, IWebHostEnvironment env, bool isInit)
static void Configure(WebApplication app, IWebHostEnvironment env, IConfiguration configuration)
{
if (!env.IsDevelopment())
{
Expand All @@ -84,18 +74,18 @@ static void Configure(WebApplication app, IWebHostEnvironment env, bool isInit)
}
//app.UseResponseCompression();
app.UseRouting();
if (isInit)
if (configuration.IsInit())
{
app.UseCors();
}
else
{
app.UseMixCors();
app.UseMixCors(configuration);
}
// ref: app.UseMixAuth();
app.UseMixAuth();

app.UseMixSwaggerApps(app.Environment.IsDevelopment(), Assembly.GetExecutingAssembly());
app.UseMixSwaggerApps(!app.Environment.IsProduction(), Assembly.GetExecutingAssembly());
app.MapControllers();
app.UseOcelot().Wait();
}
Expand Down
54 changes: 15 additions & 39 deletions src/applications/mixcore.gateway/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,18 @@
{
"profiles": {
"https": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7142;http://localhost:5025"
"profiles": {
"local": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Local",
"API_ENCRYPT_KEY": "NElUempOSmx4QVlXRFRmSys5Z0lpZz09LERBSENTUUlZWEVNYVRJRlErc256bE9Ibmo1Z0wwcm5PRm9iMDlXSEJSM0U9",
"SETTINGS_CONNECTION_STRING": "Host=localhost;Port=5432;Database=mixcore_portal;Username=postgres;Password=postgres",
"DATABASE_PROVIDER": "SQLITE",
"SERVICE_NAME": "gateway"
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7142;http://localhost:5025"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"environmentVariables": {
"ASPNETCORE_HTTPS_PORTS": "8081",
"ASPNETCORE_HTTP_PORTS": "8080"
},
"publishAllPorts": true,
"useSSL": true
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:24614",
"sslPort": 44331
}
}
"$schema": "http://json.schemastore.org/launchsettings.json"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"Logging": {
"Console": {
"TimestampFormat": "[yyyy-MM-dd HH:mm:ss] "
},
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
},
"AllowedHosts": "*"
}
5 changes: 1 addition & 4 deletions src/applications/mixcore.gateway/mixcore.gateway.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand All @@ -15,9 +15,6 @@
<ItemGroup>
<PackageReference Include="Ocelot" Version="23.3.3" />
<PackageReference Include="Ocelot.Cache.CacheManager" Version="23.3.3" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.7.1" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.7.1" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.7.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:17222;http://localhost:15061",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21048",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22225"
}
},
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15061",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19212",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20180"
}
}
}
}
12 changes: 12 additions & 0 deletions src/applications/mixcore.host.aspire.AppHost/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Logging": {
"Console": {
"TimestampFormat": "[yyyy-MM-dd HH:mm:ss] "
},
"LogLevel": {
"Default": "Error",
"Microsoft.AspNetCore": "Warning",
"Aspire.Hosting.Dcp": "Warning"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
</PropertyGroup>
<Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Dashboard" Version="8.0.0-preview.2.23619.3" />
<PackageReference Include="Aspire.Hosting.AppHost" Version="8.1.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\services\core\mix-message-queue\mix.mq.server\mix.mq.server.csproj" />
<ProjectReference Include="..\..\services\core\mix-message-queue\mix.mq.server\mix.mq.server.csproj" />
<ProjectReference Include="..\mixcore.gateway\mixcore.gateway.csproj" />
<ProjectReference Include="..\mixcore\mixcore.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\services\core\mix-message-queue\mix.mq.server\mix.mq.server.csproj" />
<ProjectReference Include="..\..\services\core\mix-message-queue\mix.mq.server\mix.mq.server.csproj" />
<ProjectReference Include="..\mixcore.gateway\mixcore.gateway.csproj" />
<ProjectReference Include="..\mixcore\mixcore.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireSharedProject>true</IsAspireSharedProject>
</PropertyGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Grafana.OpenTelemetry" Version="0.7.0-beta.2" />
<PackageReference Include="Grafana.OpenTelemetry.Base" Version="0.7.0-beta.2" />
<PackageReference Include="Grafana.OpenTelemetry" Version="1.1.0" />
<PackageReference Include="Grafana.OpenTelemetry.Base" Version="1.1.0" />

<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.8.0" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="8.1.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.7.0-rc.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.6.0-beta.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.9.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageReference Include="System.Drawing.Common" Version="8.0.8" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="9.0.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.11.0-rc.1" />
<PackageReference Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.10.0-beta.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.11.0-rc.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.10.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.10.0-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.10.0" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="9.0.0" />
</ItemGroup>

</Project>
Loading

0 comments on commit bdb0e05

Please sign in to comment.