Skip to content

Commit

Permalink
Update to .NET 8
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgDangl committed May 10, 2024
1 parent 4e19f84 commit 980890e
Show file tree
Hide file tree
Showing 14 changed files with 82 additions and 68 deletions.
15 changes: 8 additions & 7 deletions src/client/Dangl.OpenCDE.Client/Dangl.OpenCDE.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dangl.Data.Shared" Version="2.2.0" />
<PackageReference Include="ElectronNET.API" Version="23.6.1" />
<PackageReference Include="Dangl.Data.Shared" Version="2.5.0" />
<PackageReference Include="ElectronNET.API" Version="23.6.2" />
<PackageReference Include="IdentityModel" Version="6.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.11" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="7.0.11" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="7.0.11" />
<PackageReference Include="NSwag.AspNetCore" Version="13.20.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="8.0.4" />
<PackageReference Include="NSwag.AspNetCore" Version="14.0.7" />
</ItemGroup>

<ItemGroup>
Expand Down
25 changes: 25 additions & 0 deletions src/client/Dangl.OpenCDE.Client/SignalRTypesProcessor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using NSwag.Generation.Processors.Contexts;
using NSwag.Generation.Processors;
using System.Linq;

namespace Dangl.OpenCDE.Client
{
public class SignalRTypesProcessor : IDocumentProcessor
{
public void Process(DocumentProcessorContext context)
{
var signalrTypes = typeof(Dangl.OpenCDE.Client.Models.OpenIdConnectAuthenticationResult)
.Assembly
.DefinedTypes
.Where(t => t.Namespace != null && t.Namespace
.StartsWith(typeof(Dangl.OpenCDE.Client.Models.OpenIdConnectAuthenticationResult).Namespace));
foreach (var type in signalrTypes)
{
if (!context.SchemaResolver.HasSchema(type, false))
{
context.SchemaGenerator.Generate(type, context.SchemaResolver);
}
}
}
}
}
19 changes: 1 addition & 18 deletions src/client/Dangl.OpenCDE.Client/SwaggerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Dangl.OpenCDE.Shared;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using NJsonSchema;
using NSwag;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -17,6 +16,7 @@ public static void AddCdeClientSwaggerServices(this IServiceCollection services)
c.Description = "OpenCDE Client Specification";
c.Version = VersionsService.Version;
c.Title = $"OpenCDE Client {VersionsService.Version}";
c.DocumentProcessors.Add(new SignalRTypesProcessor());

c.PostProcess = (x) =>
{
Expand Down Expand Up @@ -51,22 +51,6 @@ public static void AddCdeClientSwaggerServices(this IServiceCollection services)
property.AllOf.Clear();
}
}

var signalrTypes = typeof(Dangl.OpenCDE.Client.Models.OpenIdConnectAuthenticationResult)
.Assembly
.DefinedTypes
.Where(t => t.Namespace != null && t.Namespace
.StartsWith(typeof(Dangl.OpenCDE.Client.Models.OpenIdConnectAuthenticationResult).Namespace));
foreach (var type in signalrTypes)
{
if (!x.Definitions.ContainsKey(type.Name))
{
x.Definitions.Add(type.Name, JsonSchema.FromType(type, new NJsonSchema.Generation.JsonSchemaGeneratorSettings
{
SerializerSettings = c.SerializerSettings
}));
}
}
};
});
}
Expand All @@ -75,7 +59,6 @@ public static void AddCdeClientSwaggerServices(this IServiceCollection services)
/// Adds the PfeifferAVA Swagger endpoints
/// </summary>
/// <param name="app"></param>
/// <param name="danglIdentitySettings"></param>
/// <returns></returns>
public static IApplicationBuilder UseCdeClientSwaggerUi(this IApplicationBuilder app)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private static void AddOpenCdeDocumentsApiSwaggerDocument(IServiceCollection ser
/// <returns></returns>
public static IApplicationBuilder UseOpenCdeSwaggerUi(this IApplicationBuilder app, DanglIdentitySettings danglIdentitySettings)
{
void ConfigureDanglIdentity(SwaggerUi3Settings settings)
void ConfigureDanglIdentity(SwaggerUiSettings settings)
{
settings.OAuth2Client = new OAuth2ClientSettings
{
Expand All @@ -176,7 +176,7 @@ void ConfigureDanglIdentity(SwaggerUi3Settings settings)
};
});

app.UseSwaggerUi3(settings =>
app.UseSwaggerUi(settings =>
{
ConfigureDanglIdentity(settings);

Expand Down Expand Up @@ -208,7 +208,7 @@ void ConfigureDanglIdentity(SwaggerUi3Settings settings)
};
});

app.UseSwaggerUi3(settings =>
app.UseSwaggerUi(settings =>
{
ConfigureDanglIdentity(settings);

Expand Down
14 changes: 7 additions & 7 deletions src/server/Dangl.OpenCDE.Core/Dangl.OpenCDE.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -14,12 +14,12 @@

<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="Dangl.Data.Shared.AspNetCore" Version="2.2.0" />
<PackageReference Include="LightQuery.EntityFrameworkCore" Version="2.3.0" />
<PackageReference Include="LightQuery.NSwag" Version="2.3.0" />
<PackageReference Include="NSwag.AspNetCore" Version="13.20.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.11" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="7.0.11" />
<PackageReference Include="Dangl.Data.Shared.AspNetCore" Version="2.5.0" />
<PackageReference Include="LightQuery.EntityFrameworkCore" Version="2.4.0" />
<PackageReference Include="LightQuery.NSwag" Version="2.4.0" />
<PackageReference Include="NSwag.AspNetCore" Version="14.0.7" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.4" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="8.0.4" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions src/server/Dangl.OpenCDE.Data/Dangl.OpenCDE.Data.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -10,10 +10,10 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="Dangl.Identity.Client.Mvc" Version="6.0.1" />
<PackageReference Include="Dapper" Version="2.0.151" />
<PackageReference Include="Dangl.Identity.Client.Mvc" Version="6.1.0" />
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Dapper.Logging" Version="0.4.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.4" />
</ItemGroup>

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

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions src/server/Dangl.OpenCDE/Dangl.OpenCDE.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Dangl.OpenCDE.Core\Dangl.OpenCDE.Core.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.11" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.21.0" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="7.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.4" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="8.0.4" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.AzureBlobStorage" Version="3.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.11">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
3 changes: 2 additions & 1 deletion src/server/Dangl.OpenCDE/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
Expand All @@ -7,4 +7,5 @@ FROM base AS final
WORKDIR /app
COPY . .
ENV ASPNETCORE_FORWARDEDHEADERS_ENABLED=true
ENV ASPNETCORE_URLS=http://*:80
ENTRYPOINT ["dotnet", "Dangl.OpenCDE.dll"]
17 changes: 9 additions & 8 deletions tests/Dangl.OpenCDE.Core.Tests/Dangl.OpenCDE.Core.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
<NoWarn>NETSDK1206</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="XunitXml.TestLogger" Version="3.1.17" />
<PackageReference Include="xunit" Version="2.5.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="XunitXml.TestLogger" Version="3.1.20" />
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<NoWarn>NETSDK1206</NoWarn>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\server\Dangl.OpenCDE\Dangl.OpenCDE.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Dangl.Identity.TestHost" Version="5.0.1" />
<PackageReference Include="Dangl.Identity.TestHost" Version="6.4.3" />
<PackageReference Include="Docker.DotNet" Version="3.125.15" />
<PackageReference Include="FluentAssertions" Version="6.10.0" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="Xunit.Extensions.Ordering" Version="1.4.5" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion tests/Dangl.OpenCDE.TestUtilities/TestData/Clients.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Dangl.Identity.TestHost.SetupData;
using IdentityServer4.Models;
using Duende.IdentityServer.Models;
using System.Collections.Generic;
using System.Linq;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>

<IsPackable>false</IsPackable>
<NoWarn>xUnit1041;NETSDK1206</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions.Web" Version="1.2.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="XunitXml.TestLogger" Version="3.1.17" />
<PackageReference Include="xunit" Version="2.5.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1">
<PackageReference Include="FluentAssertions.Web" Version="1.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="XunitXml.TestLogger" Version="3.1.20" />
<PackageReference Include="xunit" Version="2.8.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="6.0.0">
<PackageReference Include="coverlet.msbuild" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
3 changes: 2 additions & 1 deletion utils/Dangl.OpenCDE.DataSeed/Dangl.OpenCDE.DataSeed.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<NoWarn>NETSDK1206</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 980890e

Please sign in to comment.