From a5be5954858439f1d44f72bb26e3f34e240ff061 Mon Sep 17 00:00:00 2001 From: Milan Martiniak Date: Fri, 25 Mar 2022 21:18:14 +0100 Subject: [PATCH 1/2] .net 6 support --- demo/ApiGateway/ApiGateway.csproj | 8 ++++---- .../ApiGatewayWithEndpointInterceptor.csproj | 6 +++--- demo/ApiGatewayWithPath/ApiGatewayWithPath.csproj | 6 +++--- demo/ApiGatewayWithPath/ocelot.json | 2 +- demo/ContactService/ContactService.csproj | 4 ++-- demo/ContactService/Startup.cs | 2 +- demo/OrderService/OrderService.csproj | 6 +++--- demo/OrderService/Startup.cs | 3 +-- demo/PetstoreService/PetstoreService.csproj | 2 +- demo/ProjectService/ProjectService.csproj | 4 ++-- .../MMLib.SwaggerForOcelot.csproj | 14 +++++++------- .../MMLib.SwaggerForOcelot.Tests.csproj | 14 +++++++------- 12 files changed, 35 insertions(+), 36 deletions(-) diff --git a/demo/ApiGateway/ApiGateway.csproj b/demo/ApiGateway/ApiGateway.csproj index 412b5f5..846d6b6 100644 --- a/demo/ApiGateway/ApiGateway.csproj +++ b/demo/ApiGateway/ApiGateway.csproj @@ -1,14 +1,14 @@  - net5.0 + net6.0 - + - - + + diff --git a/demo/ApiGatewayWithEndpointInterceptor/ApiGatewayWithEndpointInterceptor.csproj b/demo/ApiGatewayWithEndpointInterceptor/ApiGatewayWithEndpointInterceptor.csproj index 2446946..7703f54 100644 --- a/demo/ApiGatewayWithEndpointInterceptor/ApiGatewayWithEndpointInterceptor.csproj +++ b/demo/ApiGatewayWithEndpointInterceptor/ApiGatewayWithEndpointInterceptor.csproj @@ -1,13 +1,13 @@  - net5.0 + net6.0 ApiGatewayWithEndpointSecurity - - + + diff --git a/demo/ApiGatewayWithPath/ApiGatewayWithPath.csproj b/demo/ApiGatewayWithPath/ApiGatewayWithPath.csproj index 77f7bd5..e079614 100644 --- a/demo/ApiGatewayWithPath/ApiGatewayWithPath.csproj +++ b/demo/ApiGatewayWithPath/ApiGatewayWithPath.csproj @@ -1,12 +1,12 @@  - net5.0 + net6.0 - - + + diff --git a/demo/ApiGatewayWithPath/ocelot.json b/demo/ApiGatewayWithPath/ocelot.json index eb24741..86f330a 100644 --- a/demo/ApiGatewayWithPath/ocelot.json +++ b/demo/ApiGatewayWithPath/ocelot.json @@ -59,7 +59,7 @@ { "Name": "Contacts API", "Version": "v1", - "Url": "http://localhost:5000/swagger/v1/swagger.json" + "Url": "http://localhost:5100/swagger/v1/swagger.json" } ] }, diff --git a/demo/ContactService/ContactService.csproj b/demo/ContactService/ContactService.csproj index 4c895ac..6bcec44 100644 --- a/demo/ContactService/ContactService.csproj +++ b/demo/ContactService/ContactService.csproj @@ -1,11 +1,11 @@  - net5.0 + net6.0 - + diff --git a/demo/ContactService/Startup.cs b/demo/ContactService/Startup.cs index b909313..9917f01 100644 --- a/demo/ContactService/Startup.cs +++ b/demo/ContactService/Startup.cs @@ -20,7 +20,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0); + services.AddMvc(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo() { Title = "Contacts API", Version = "v1" }); diff --git a/demo/OrderService/OrderService.csproj b/demo/OrderService/OrderService.csproj index 071387a..7b4173f 100644 --- a/demo/OrderService/OrderService.csproj +++ b/demo/OrderService/OrderService.csproj @@ -1,16 +1,16 @@  - net5.0 + net6.0 InProcess OrderService bin\$(Configuration)\$(TargetFramework)\$(MSBuildThisFileName).xml - + - + diff --git a/demo/OrderService/Startup.cs b/demo/OrderService/Startup.cs index d17d1b2..69f334e 100644 --- a/demo/OrderService/Startup.cs +++ b/demo/OrderService/Startup.cs @@ -8,7 +8,6 @@ using Swashbuckle.AspNetCore.SwaggerGen; using System.IO; using System.Reflection; -using static Microsoft.AspNetCore.Mvc.CompatibilityVersion; namespace OrderService { @@ -40,7 +39,7 @@ public void ConfigureServices(IServiceCollection services) { // the sample application always uses the latest version, but you may want an explicit version such as Version_2_2 // note: Endpoint Routing is enabled by default; however, if you need legacy style routing via IRouter, change it to false - services.AddMvc(options => options.EnableEndpointRouting = true).SetCompatibilityVersion(Latest); + services.AddMvc(options => options.EnableEndpointRouting = true); services.AddApiVersioning( options => { diff --git a/demo/PetstoreService/PetstoreService.csproj b/demo/PetstoreService/PetstoreService.csproj index 125c95b..edf0dfb 100644 --- a/demo/PetstoreService/PetstoreService.csproj +++ b/demo/PetstoreService/PetstoreService.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 diff --git a/demo/ProjectService/ProjectService.csproj b/demo/ProjectService/ProjectService.csproj index d22ddf6..69a7106 100644 --- a/demo/ProjectService/ProjectService.csproj +++ b/demo/ProjectService/ProjectService.csproj @@ -1,12 +1,12 @@  - net5.0 + net6.0 - + diff --git a/src/MMLib.SwaggerForOcelot/MMLib.SwaggerForOcelot.csproj b/src/MMLib.SwaggerForOcelot/MMLib.SwaggerForOcelot.csproj index 774aab0..ffc49b7 100644 --- a/src/MMLib.SwaggerForOcelot/MMLib.SwaggerForOcelot.csproj +++ b/src/MMLib.SwaggerForOcelot/MMLib.SwaggerForOcelot.csproj @@ -1,8 +1,8 @@  - net5.0 - 4.9.0 + net6.0 + 5.0.0 Milan Martiniak MMLib Swagger generator for Ocelot downstream services. @@ -27,11 +27,11 @@ - - - - - + + + + + diff --git a/tests/MMLib.SwaggerForOcelot.Tests/MMLib.SwaggerForOcelot.Tests.csproj b/tests/MMLib.SwaggerForOcelot.Tests/MMLib.SwaggerForOcelot.Tests.csproj index 3629085..e749917 100644 --- a/tests/MMLib.SwaggerForOcelot.Tests/MMLib.SwaggerForOcelot.Tests.csproj +++ b/tests/MMLib.SwaggerForOcelot.Tests/MMLib.SwaggerForOcelot.Tests.csproj @@ -55,14 +55,14 @@ - - - - - - + + + + + + - + all runtime; build; native; contentfiles; analyzers From 47c23d425e1b4e9cf741d5fb22667ffb465a3506 Mon Sep 17 00:00:00 2001 From: Milan Martiniak Date: Fri, 25 Mar 2022 21:21:02 +0100 Subject: [PATCH 2/2] fix warning --- demo/ApiGatewayWithEndpointInterceptor/Startup.cs | 3 +-- demo/ApiGatewayWithPath/Startup.cs | 3 +-- demo/ProjectService/Startup.cs | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/demo/ApiGatewayWithEndpointInterceptor/Startup.cs b/demo/ApiGatewayWithEndpointInterceptor/Startup.cs index 029f6ff..d44916d 100644 --- a/demo/ApiGatewayWithEndpointInterceptor/Startup.cs +++ b/demo/ApiGatewayWithEndpointInterceptor/Startup.cs @@ -2,7 +2,6 @@ using ApiGatewayWithEndpointSecurity.Repository; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Ocelot.DependencyInjection; @@ -29,7 +28,7 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(); services.AddSingleton(); - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0); + services.AddMvc(); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) diff --git a/demo/ApiGatewayWithPath/Startup.cs b/demo/ApiGatewayWithPath/Startup.cs index 4ddc0e3..94b836d 100644 --- a/demo/ApiGatewayWithPath/Startup.cs +++ b/demo/ApiGatewayWithPath/Startup.cs @@ -1,6 +1,5 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Ocelot.DependencyInjection; @@ -24,7 +23,7 @@ public void ConfigureServices(IServiceCollection services) services.AddOcelot(); services.AddSwaggerForOcelot(Configuration); - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0); + services.AddMvc(); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) diff --git a/demo/ProjectService/Startup.cs b/demo/ProjectService/Startup.cs index 67d6cca..0df0b25 100644 --- a/demo/ProjectService/Startup.cs +++ b/demo/ProjectService/Startup.cs @@ -1,6 +1,5 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.OpenApi.Models; @@ -20,7 +19,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0); + services.AddMvc(); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo()