From 3530e8aaeb70e30ea409e17df782f09f815a68b0 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Thu, 14 Nov 2024 22:16:24 -0800 Subject: [PATCH] Update to .NET 9 - Update all packages - Added nuget.config --- Directory.Build.props | 2 +- Directory.Packages.props | 58 +++++++++---------- TodoApi.AppHost/TodoApi.AppHost.csproj | 3 - .../TodoApi.ServiceDefaults.csproj | 3 - TodoApi.sln | 2 + TodoApi/Extensions/OpenApiExtensions.cs | 24 -------- TodoApi/Users/UsersApi.cs | 5 +- global.json | 2 +- nuget.config | 13 +++++ 9 files changed, 49 insertions(+), 63 deletions(-) create mode 100644 nuget.config diff --git a/Directory.Build.props b/Directory.Build.props index e945a6d2..0b02358d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable preview diff --git a/Directory.Packages.props b/Directory.Packages.props index 401887bb..b9427470 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,42 +3,42 @@ true - - - - - - + + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - - + + + + + + + - - - - - + + + + + \ No newline at end of file diff --git a/TodoApi.AppHost/TodoApi.AppHost.csproj b/TodoApi.AppHost/TodoApi.AppHost.csproj index ced1d6ec..f8715d5f 100644 --- a/TodoApi.AppHost/TodoApi.AppHost.csproj +++ b/TodoApi.AppHost/TodoApi.AppHost.csproj @@ -4,9 +4,6 @@ Exe - net8.0 - enable - enable true 22f8485f-c345-41fa-9f21-ba96b1e511d1 diff --git a/TodoApi.ServiceDefaults/TodoApi.ServiceDefaults.csproj b/TodoApi.ServiceDefaults/TodoApi.ServiceDefaults.csproj index 4f74b4fb..995d7c12 100644 --- a/TodoApi.ServiceDefaults/TodoApi.ServiceDefaults.csproj +++ b/TodoApi.ServiceDefaults/TodoApi.ServiceDefaults.csproj @@ -1,9 +1,6 @@ - net8.0 - enable - enable true diff --git a/TodoApi.sln b/TodoApi.sln index fc505a41..ac1a978b 100644 --- a/TodoApi.sln +++ b/TodoApi.sln @@ -11,6 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject Directory.Build.props = Directory.Build.props Directory.Packages.props = Directory.Packages.props + global.json = global.json + nuget.config = nuget.config README.md = README.md EndProjectSection EndProject diff --git a/TodoApi/Extensions/OpenApiExtensions.cs b/TodoApi/Extensions/OpenApiExtensions.cs index 2d544bd9..818936cd 100644 --- a/TodoApi/Extensions/OpenApiExtensions.cs +++ b/TodoApi/Extensions/OpenApiExtensions.cs @@ -37,28 +37,4 @@ public static IEndpointConventionBuilder AddOpenApiSecurity(this IEndpointConven } }); } - - public static IEndpointConventionBuilder Produces(this IEndpointConventionBuilder builder, string schemaReference) - { - return builder.WithOpenApi(operation => - { - var response = new OpenApiResponse - { - Description = "Success", - Content = - { - ["application/json"] = new OpenApiMediaType - { - Schema = new OpenApiSchema - { - Reference = new OpenApiReference { Type = ReferenceType.Schema, Id = schemaReference } - } - } - } - }; - - operation.Responses.Add("200", response); - return new(operation); - }); - } } diff --git a/TodoApi/Users/UsersApi.cs b/TodoApi/Users/UsersApi.cs index 523f0a82..0308c5c0 100644 --- a/TodoApi/Users/UsersApi.cs +++ b/TodoApi/Users/UsersApi.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Http.HttpResults; +using Microsoft.AspNetCore.Authentication.BearerToken; +using Microsoft.AspNetCore.Http.HttpResults; using Microsoft.AspNetCore.Identity; namespace TodoApi; @@ -46,7 +47,7 @@ public static RouteGroupBuilder MapUsers(this IEndpointRouteBuilder routes) }) // Add the open API response for 200 since AccessTokenResponse // is internal and we don't want to duplicate it. - .Produces("AccessTokenResponse"); + .Produces(); return group; } diff --git a/global.json b/global.json index d4e0b899..8f4a14c2 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.0", + "version": "9.0.100", "rollForward": "latestFeature", "allowPrerelease": true } diff --git a/nuget.config b/nuget.config new file mode 100644 index 00000000..164dd8c1 --- /dev/null +++ b/nuget.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + +