diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml
index 8d09f76..517f9be 100644
--- a/.github/workflows/pull-request.yml
+++ b/.github/workflows/pull-request.yml
@@ -19,9 +19,9 @@ jobs:
uses: actions/checkout@v2
- name: install dotnet
- uses: actions/setup-dotnet@v1
+ uses: actions/setup-dotnet@v3
with:
- dotnet-version: '3.1.x'
+ dotnet-version: 8.0.x
- name: install packages
run: dotnet restore
diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml
index d19d6f5..897617d 100644
--- a/.github/workflows/push.yml
+++ b/.github/workflows/push.yml
@@ -19,9 +19,9 @@ jobs:
uses: actions/checkout@v2
- name: install dotnet
- uses: actions/setup-dotnet@v1
+ uses: actions/setup-dotnet@v3
with:
- dotnet-version: '3.1.x'
+ dotnet-version: 8.0.x
- name: install packages
run: dotnet restore
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index a86439e..f6297e1 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -12,11 +12,11 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@master
-
+
- name: install dotnet
- uses: actions/setup-dotnet@v1
+ uses: actions/setup-dotnet@v3
with:
- dotnet-version: 3.1.x
+ dotnet-version: 8.0.x
- name: build
run: dotnet build
diff --git a/README.md b/README.md
index fdf83ab..33a2d36 100644
--- a/README.md
+++ b/README.md
@@ -96,7 +96,7 @@ A detailed overview on how to contribute can be found in the [contributing guide
Make sure you have installed all of the following prerequisites on your development machine:
- Git - [Download & Install Git](https://git-scm.com/downloads). OSX and Linux machines typically have this already installed.
-- .NET Core (version 3.1 or higher) - [Download & Install .NET Core](https://dotnet.microsoft.com/download/dotnet-core/3.1).
+- .NET (version 8.0 or higher) - [Download & Install .NET Core](https://dotnet.microsoft.com/download/dotnet/8.0).
## General folders layout
@@ -116,4 +116,4 @@ Make sure you have installed all of the following prerequisites on your developm
# Maintainers
-[github.maintain@byndyusoft.com](mailto:github.maintain@byndyusoft.com)
\ No newline at end of file
+[github.maintain@byndyusoft.com](mailto:github.maintain@byndyusoft.com)
diff --git a/example/Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.Example.csproj b/example/Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.Example.csproj
index d2462ca..5879e2f 100644
--- a/example/Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.Example.csproj
+++ b/example/Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.Example.csproj
@@ -2,15 +2,15 @@
Exe
- netcoreapp3.1
+ net8.0
Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack
true
-
-
-
+
+
+
diff --git a/example/Program.cs b/example/Program.cs
index f84b015..d8d724c 100644
--- a/example/Program.cs
+++ b/example/Program.cs
@@ -1,28 +1,41 @@
-using Microsoft.AspNetCore.Hosting;
+using Asp.Versioning;
+using Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.Swagger;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-namespace Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack
-{
- ///
- /// Program
- ///
- public static class Program
- {
- ///
- /// Main
- ///
- public static void Main(string[] args)
+var builder = WebApplication.CreateBuilder(args);
+
+var services = builder.Services;
+services
+ .AddApiVersioning(
+ options =>
{
- CreateHostBuilder(args).Build().Run();
+ options.DefaultApiVersion = ApiVersion.Default;
+ options.AssumeDefaultVersionWhenUnspecified = true;
+ options.ReportApiVersions = true;
}
-
- private static IHostBuilder CreateHostBuilder(string[] args)
+ )
+ .AddApiExplorer(
+ options =>
{
- return Host.CreateDefaultBuilder(args)
- .ConfigureWebHostDefaults(webBuilder =>
- {
- webBuilder.UseStartup();
- });
+ options.GroupNameFormat = "'v'VVV";
+ options.SubstituteApiVersionInUrl = true;
}
- }
-}
\ No newline at end of file
+ );
+
+services.AddSwagger();
+
+services
+ .AddMvcCore()
+ .AddMessagePackFormatters()
+ .AddFormatterMappings();
+services.AddControllers();
+
+var app = builder.Build();
+if (app.Environment.IsProduction() == false)
+ app.UseSwaggerWithApiVersionDescriptionProvider();
+
+app.MapControllers();
+app.UseRouting();
+app.Run();
\ No newline at end of file
diff --git a/example/Startup.cs b/example/Startup.cs
deleted file mode 100644
index e4ce8a8..0000000
--- a/example/Startup.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.Swagger;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.AspNetCore.Mvc.ApiExplorer;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
-
-namespace Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack
-{
- ///
- /// Startup
- ///
- public class Startup
- {
- ///
- /// ConfigureServices
- ///
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddApiVersioning(options =>
- {
- options.DefaultApiVersion = ApiVersion.Default;
- options.AssumeDefaultVersionWhenUnspecified = true;
- options.ReportApiVersions = true;
- })
- .AddVersionedApiExplorer(options =>
- {
- options.GroupNameFormat = "'v'VVV";
- options.SubstituteApiVersionInUrl = true;
- });
-
- services.AddSwagger();
-
- services.AddMvcCore()
- .AddMessagePackFormatters()
- .AddFormatterMappings();
- services.AddControllers();
- }
-
- ///
- /// Configure
- ///
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IApiVersionDescriptionProvider apiVersionDescriptionProvider)
- {
- if (env.IsProduction() == false)
- app.UseSwagger(apiVersionDescriptionProvider);
-
- app
- .UseRouting()
- .UseEndpoints(endpoints => endpoints.MapControllers());
- }
- }
-}
\ No newline at end of file
diff --git a/example/Swagger/ApplicationBuilderExtensions.cs b/example/Swagger/ApplicationBuilderExtensions.cs
index 78301e7..5762946 100644
--- a/example/Swagger/ApplicationBuilderExtensions.cs
+++ b/example/Swagger/ApplicationBuilderExtensions.cs
@@ -1,5 +1,6 @@
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Mvc.ApiExplorer;
+using Asp.Versioning.ApiExplorer;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.Extensions.DependencyInjection;
using Swashbuckle.AspNetCore.SwaggerUI;
namespace Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.Swagger
@@ -12,10 +13,10 @@ public static class ApplicationBuilderExtensions
///
/// UseSwagger
///
- public static IApplicationBuilder UseSwagger(
- this IApplicationBuilder builder,
- IApiVersionDescriptionProvider apiVersionDescriptionProvider)
+ public static IApplicationBuilder UseSwaggerWithApiVersionDescriptionProvider(
+ this IApplicationBuilder builder)
{
+ var apiVersionDescriptionProvider = builder.ApplicationServices.GetService()!;
builder.UseSwagger()
.UseSwaggerUI(options =>
{
diff --git a/example/Swagger/ConfigureSwaggerOptions.cs b/example/Swagger/ConfigureSwaggerOptions.cs
index 0b0349c..88edee4 100644
--- a/example/Swagger/ConfigureSwaggerOptions.cs
+++ b/example/Swagger/ConfigureSwaggerOptions.cs
@@ -1,11 +1,11 @@
-using Microsoft.AspNetCore.Mvc.ApiExplorer;
-using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
using System;
using System.IO;
using System.Reflection;
+using Asp.Versioning.ApiExplorer;
namespace Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.Swagger
{
diff --git a/src/Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.csproj b/src/Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.csproj
index 9a655cb..5d5f2bd 100644
--- a/src/Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.csproj
+++ b/src/Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.csproj
@@ -2,9 +2,9 @@
true
- netcoreapp3.1
+ netstandard2.0;net8.0
Microsoft.AspNetCore.Mvc
- 0.3.1
+ 0.4.0
Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack
Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack
Byndyusoft
@@ -14,17 +14,22 @@
git
icon.png
MIT
+ latest
-
+
-
-
+
+
+
-
+
+
+
+
\ No newline at end of file
diff --git a/src/Formatters/MessagePackOutputFormatter.cs b/src/Formatters/MessagePackOutputFormatter.cs
index 779ec33..c9ec45c 100644
--- a/src/Formatters/MessagePackOutputFormatter.cs
+++ b/src/Formatters/MessagePackOutputFormatter.cs
@@ -27,8 +27,8 @@ internal MessagePackOutputFormatter(MessagePackSerializerOptions serializerOptio
{
SerializerOptions = Guard.NotNull(serializerOptions, nameof(serializerOptions));
- SupportedMediaTypes.Add(MessagePackDefaults.MediaTypes.ApplicationXMessagePack);
SupportedMediaTypes.Add(MessagePackDefaults.MediaTypes.ApplicationMessagePack);
+ SupportedMediaTypes.Add(MessagePackDefaults.MediaTypes.ApplicationXMessagePack);
}
diff --git a/src/MvcMessagePackOptions.cs b/src/MvcMessagePackOptions.cs
index 08f39d3..a461f4e 100644
--- a/src/MvcMessagePackOptions.cs
+++ b/src/MvcMessagePackOptions.cs
@@ -23,8 +23,8 @@ public MvcMessagePackOptions()
_allowInputFormatterExceptionMessages =
new CompatibilitySwitch(nameof(AllowInputFormatterExceptionMessages));
- SupportedMediaTypes.Add(MessagePackDefaults.MediaTypes.ApplicationXMessagePack);
SupportedMediaTypes.Add(MessagePackDefaults.MediaTypes.ApplicationMessagePack);
+ SupportedMediaTypes.Add(MessagePackDefaults.MediaTypes.ApplicationXMessagePack);
}
///
diff --git a/tests/Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.Tests.csproj b/tests/Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.Tests.csproj
index c493305..44416ea 100644
--- a/tests/Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.Tests.csproj
+++ b/tests/Byndyusoft.AspNetCore.Mvc.Formatters.MessagePack.Tests.csproj
@@ -1,21 +1,20 @@
-
+
- netcoreapp3.1
+ net8.0
false
Byndyusoft.AspNetCore.Mvc.Formatters
-
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive