Skip to content

Commit

Permalink
Update to .net 9
Browse files Browse the repository at this point in the history
  • Loading branch information
josephdecock committed Sep 20, 2024
1 parent f01e45f commit 890b264
Show file tree
Hide file tree
Showing 38 changed files with 172 additions and 61 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ csharp_space_between_square_brackets=false
csharp_preserve_single_line_blocks=true
csharp_preserve_single_line_statements=true

# IDE0160: Convert to block scoped namespace
csharp_style_namespace_declarations = file_scoped

[*]
charset=utf-8
end_of_line=lf
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.100
8.0.x
9.0.x
- run: dotnet --info

Expand Down
80 changes: 76 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// Hosts
//-------
{
"name": "host: main",
"name": "host: main (dotnet 8)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-host-main",
Expand All @@ -43,7 +43,25 @@
}
},
{
"name": "host: AspNetIdentity",
"name": "host: main (dotnet 9)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-host-main",
"program": "${workspaceFolder}/hosts/main/bin/Debug/net9.0/Host.Main.dll",
"args": [],
"cwd": "${workspaceFolder}/hosts/main",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"console": "externalTerminal",
"presentation": {
"hidden": false,
"group": "10-hosts",
"order": 10
}
},
{
"name": "host: AspNetIdentity (dotnet 8)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-host-aspnetidentity",
Expand All @@ -61,7 +79,25 @@
}
},
{
"name": "host: EntityFramework",
"name": "host: AspNetIdentity (dotnet 9)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-host-aspnetidentity",
"program": "${workspaceFolder}/hosts/AspNetIdentity/bin/Debug/net9.0/Host.AspNetIdentity.dll",
"args": [],
"cwd": "${workspaceFolder}/hosts/AspNetIdentity",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"console": "externalTerminal",
"presentation": {
"hidden": false,
"group": "10-hosts",
"order": 30
}
},
{
"name": "host: EntityFramework (dotnet 8)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-host-entityframework",
Expand All @@ -79,7 +115,25 @@
}
},
{
"name": "host: Configuration",
"name": "host: EntityFramework (dotnet 9)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-host-entityframework",
"program": "${workspaceFolder}/hosts/EntityFramework/bin/Debug/net9.0/Host.EntityFramework.dll",
"args": [],
"cwd": "${workspaceFolder}/hosts/EntityFramework",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"console": "externalTerminal",
"presentation": {
"hidden": false,
"group": "10-hosts",
"order": 40
}
},
{
"name": "host: Configuration (dotnet 8)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-host-configuration",
Expand All @@ -96,6 +150,24 @@
"order": 50
}
},
{
"name": "host: Configuration (dotnet 9)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-host-configuration",
"program": "${workspaceFolder}/hosts/Configuration/bin/Debug/net9.0/Host.Configuration.dll",
"args": [],
"cwd": "${workspaceFolder}/hosts/Configuration",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"console": "externalTerminal",
"presentation": {
"hidden": false,
"group": "10-hosts",
"order": 50
}
},
//------------
// Migrations
//------------
Expand Down
12 changes: 11 additions & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
<ExtensionsVersion>8.0.0</ExtensionsVersion>
<EntityFrameworkVersion>8.0.0</EntityFrameworkVersion>
<WilsonVersion>7.1.2</WilsonVersion>
<SqlClientVersion>5.1.6</SqlClientVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net9.0'">
<FrameworkVersion>9.0.0-rc.1.24452.1</FrameworkVersion>
<ExtensionsVersion>9.0.0-rc.1.24431.7</ExtensionsVersion>
<EntityFrameworkVersion>9.0.0-rc.1.24451.1</EntityFrameworkVersion>
<WilsonVersion>8.0.1</WilsonVersion>
<SqlClientVersion>5.2.1</SqlClientVersion>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -79,8 +88,9 @@
problem exist someday). -->
<PackageReference Update="Azure.Identity" Version="1.11.4" />
<PackageReference Update="System.Formats.Asn1" Version="8.0.1" />
<PackageReference Update="Microsoft.Data.SqlClient" Version="5.1.6" />
<PackageReference Update="Microsoft.Data.SqlClient" Version="$(SqlClientVersion)" />
<PackageReference Update="System.Text.Json" Version="8.0.4" />
<PackageReference Update="System.Drawing.Common" Version="6.0.0" />
</ItemGroup>

<Target Name="SetAssemblyVersion" AfterTargets="MinVer">
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "8.0.100",
"version": "9.0.100-rc.1",
"rollForward": "latestMajor",
"allowPrerelease": false
}
}
}
3 changes: 1 addition & 2 deletions hosts/AspNetIdentity/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@
// shared
[assembly: SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Main catches and logs all exceptions by design")]
[assembly: SuppressMessage("Naming", "CA1724:Type names should not match namespaces", Justification = "Resources is only used for initialization, so there is little chance of confusion", Scope = "type", Target = "~T:IdentityServerHost.Configuration.Resources")]


[assembly: SuppressMessage("Maintainability", "CA1515:Consider making public types internal", Justification = "Maybe we'll do this someday, but right now it seems a dull chore", Scope = "module")]
4 changes: 2 additions & 2 deletions hosts/AspNetIdentity/Host.AspNetIdentity.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>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<RootNamespace>IdentityServerHost</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down Expand Up @@ -36,7 +36,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference
<ProjectReference
Include="..\..\src\AspNetIdentity\Duende.IdentityServer.AspNetIdentity.csproj" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions hosts/AspNetIdentity/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=Duende.AspNetIdentity-6.0.0;Trusted_Connection=True;MultipleActiveResultSets=true"
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=Duende.AspNetIdentity-7.1.0;Trusted_Connection=True;MultipleActiveResultSets=true"
}
}
}
1 change: 1 addition & 0 deletions hosts/Configuration/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// shared
[assembly: SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Main catches and logs all exceptions by design")]
[assembly: SuppressMessage("Naming", "CA1724:Type names should not match namespaces", Justification = "Resources is only used for initialization, so there is little chance of confusion", Scope = "type", Target = "~T:IdentityServerHost.Configuration.Resources")]
[assembly: SuppressMessage("Maintainability", "CA1515:Consider making public types internal", Justification = "Maybe we'll do this someday, but right now it seems a dull chore", Scope = "module")]

// specific to this project
[assembly: SuppressMessage("Performance", "CA1812:Avoid uninstantiated internal classes", Justification = "CustomClientRegistrationProcessor is created through DI", Scope = "type", Target = "~T:IdentityServerHost.CustomClientRegistrationProcessor")]
6 changes: 4 additions & 2 deletions hosts/Configuration/Host.Configuration.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<RootNamespace>IdentityServerHost</RootNamespace>
<UserSecretsId>e60c119c-8b86-4016-9d44-80e25948dbba</UserSecretsId>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AnalysisMode>all</AnalysisMode>
<AnalysisMode>all</AnalysisMode>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -46,6 +46,8 @@
<PackageReference Include="Azure.Identity" />
<PackageReference Include="System.Formats.Asn1" />
<PackageReference Include="Microsoft.Data.SqlClient" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Drawing.Common" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions hosts/Configuration/IdentityServerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ private static IIdentityServerBuilder AddStaticSigningCredential(this IIdentityS
// create random RS256 key
//builder.AddDeveloperSigningCredential();


#pragma warning disable SYSLIB0057 // Type or member is obsolete
// TODO - Use X509CertificateLoader in a future release (when we drop NET8 support)

// use an RSA-based certificate with RS256
using var rsaCert = new X509Certificate2("./testkeys/identityserver.test.rsa.p12", "changeit");
builder.AddSigningCredential(rsaCert, "RS256");
Expand All @@ -82,6 +86,8 @@ private static IIdentityServerBuilder AddStaticSigningCredential(this IIdentityS

// or manually extract ECDSA key from certificate (directly using the certificate is not support by Microsoft right now)
using var ecCert = new X509Certificate2("./testkeys/identityserver.test.ecdsa.p12", "changeit");
#pragma warning restore SYSLIB0057 // Type or member is obsolete

var key = new ECDsaSecurityKey(ecCert.GetECDsaPrivateKey())
{
KeyId = CryptoRandom.CreateUniqueId(16, CryptoRandom.OutputFormat.Hex)
Expand Down
3 changes: 1 addition & 2 deletions hosts/EntityFramework/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@
// shared
[assembly: SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Main catches and logs all exceptions by design")]
[assembly: SuppressMessage("Naming", "CA1724:Type names should not match namespaces", Justification = "Resources is only used for initialization, so there is little chance of confusion", Scope = "type", Target = "~T:IdentityServerHost.Configuration.Resources")]


[assembly: SuppressMessage("Maintainability", "CA1515:Consider making public types internal", Justification = "Maybe we'll do this someday, but right now it seems a dull chore", Scope = "module")]
4 changes: 2 additions & 2 deletions hosts/EntityFramework/Host.EntityFramework.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>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<RootNamespace>IdentityServerHost</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand All @@ -13,7 +13,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" />

<PackageReference Include="OpenTelemetry" />
<PackageReference Include="OpenTelemetry" />
<PackageReference Include="OpenTelemetry.Exporter.Console" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" />
Expand Down
8 changes: 0 additions & 8 deletions hosts/EntityFramework/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{
"iisSettings": {
"windowsAuthentication": true,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:5000",
"sslPort": 44334
}
},
"profiles": {
"Host": {
"commandName": "Project",
Expand Down
3 changes: 1 addition & 2 deletions hosts/main/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@
// shared
[assembly: SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Main catches and logs all exceptions by design")]
[assembly: SuppressMessage("Naming", "CA1724:Type names should not match namespaces", Justification = "Resources is only used for initialization, so there is little chance of confusion", Scope = "type", Target = "~T:IdentityServerHost.Configuration.Resources")]


[assembly: SuppressMessage("Maintainability", "CA1515:Consider making public types internal", Justification = "Maybe we'll do this someday, but right now it seems a dull chore", Scope = "module")]
13 changes: 9 additions & 4 deletions hosts/main/Host.Main.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>
<TargetFrameworks>net8.0; net9.0</TargetFrameworks>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<RootNamespace>IdentityServerHost</RootNamespace>
<UserSecretsId>e60c119c-8b86-4016-9d44-80e25948dbba</UserSecretsId>
Expand Down Expand Up @@ -34,11 +34,16 @@
<PackageReference Include="OpenTelemetry.Instrumentation.SqlClient" />

<PackageReference Include="Serilog.AspNetCore" />
</ItemGroup>

<!-- This may not be necessary long term, once asp.net core updates its wilson dependencies -->
<PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" />

<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<!-- These two dependencies should hopefully be removed in a future release.
The dotnet 9.0-rc.1 version of some of the EF packages has transitive
dependnecies with vulnerabilites -->
<PackageReference Include="System.Text.Json" />
<PackageReference Include="System.Drawing.Common" />
</ItemGroup>


<ItemGroup>
<ProjectReference Include="..\..\src\IdentityServer\Duende.IdentityServer.csproj" />
Expand Down
Loading

0 comments on commit 890b264

Please sign in to comment.