Skip to content

Commit

Permalink
Add .NET 6 Preview support, closes #147
Browse files Browse the repository at this point in the history
Update common properties
  • Loading branch information
cd21h committed Apr 19, 2021
1 parent 0354100 commit f9662d1
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 26 deletions.
15 changes: 13 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<Project>

<PropertyGroup Label="Common">
<LibraryTargetFrameworks>netstandard2.0;netstandard2.1;net5.0;net6.0</LibraryTargetFrameworks>
<ApplicationTargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0;net6.0</ApplicationTargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="Build">
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5</TargetFrameworks>
<TargetFrameworks>$(LibraryTargetFrameworks)</TargetFrameworks>
<SignAssembly>True</SignAssembly>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
Expand Down Expand Up @@ -40,8 +45,14 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<PropertyGroup Condition=" '$(MSBuildProjectFullPath.Contains(samples))' == true">
<TargetFrameworks>$(ApplicationTargetFrameworks)</TargetFrameworks>
<NoWarn>$(NoWarn);CS0618;CS1591</NoWarn>
</PropertyGroup>

<PropertyGroup Condition=" '$(MSBuildProjectName.Contains(Tests))' == true ">
<NoWarn>$(NoWarn);CS0618</NoWarn>
<TargetFrameworks>$(ApplicationTargetFrameworks)</TargetFrameworks>
<NoWarn>$(NoWarn);CS0618;CS1591</NoWarn>
<IsTestProject>true</IsTestProject>
<IsPackable>False</IsPackable>
</PropertyGroup>
Expand Down
5 changes: 5 additions & 0 deletions src/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "6.0.100-preview.3.21202.5"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Build">
<TargetFrameworks>$(ApplicationTargetFrameworks)</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="Package">
<PackageTags>messagepack msgpack mvc-core formatter alphacloud</PackageTags>
<Description>MessagePack formatters for ASP.NET Core MVC</Description>
Expand All @@ -21,11 +25,16 @@
<PackageReference Include="System.IO.Pipelines" Version="4.7.3" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net5'">
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="System.IO.Pipelines" Version="5.0.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="System.IO.Pipelines" Version="6.0.0-preview.3.*" />
</ItemGroup>

<ItemGroup Label="Package References">
<PackageReference Include="JetBrains.Annotations" Version="2021.1.0" PrivateAssets="All" />
<PackageReference Include="MessagePack" Version="[2.2.85, 3.0.0)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context)
return MessagePackSerializer.SerializeAsync(context.ObjectType, context.HttpContext.Response.Body, context.Object, _options,
context.HttpContext.RequestAborted);
}
#elif NETCOREAPP3_1 || NET5_0
#elif NETCOREAPP3_1 || NET5_0 || NET6_0
/// <inheritdoc />
public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Build">
<TargetFrameworks>netstandard2.0;netstandard2.1;net5</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="Package">
<PackageTags>messagepack msgpack webapi formatter serialization webapi-client alphacloud</PackageTags>
<Description>MessagePack formatters for WebApi client (Microsoft.AspNet.WebApi.Client).</Description>
Expand All @@ -17,7 +13,7 @@
<PackageReference Include="System.Collections.Immutable" Version="1.7.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net5'">
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
<PackageReference Include="System.Collections.Immutable" Version="5.0.0" />
</ItemGroup>

Expand Down
13 changes: 7 additions & 6 deletions src/samples/NetCoreWebApi/NetCoreWebApi.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup Label="Build">
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<NoWarn>$(NoWarn);1573;1591</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.10.0" />
</ItemGroup>
Expand All @@ -21,12 +16,18 @@
<PackageReference Include="Serilog.Sinks.Seq" Version="5.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net5'">
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.0-preview.3.*" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\lib\Alphacloud.MessagePack.AspNetCore.Formatters\Alphacloud.MessagePack.AspNetCore.Formatters.csproj" />
</ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/samples/NetCoreWebApi/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
#if NETCOREAPP3_1 || NET5_0
#if NETCOREAPP3_1 || NET5_0 || NET6_0
using Microsoft.Extensions.Hosting;
#endif
using Microsoft.Extensions.Configuration;
Expand All @@ -29,7 +29,7 @@ public void ConfigureServices(IServiceCollection services)
options.Compression = MessagePackCompression.Lz4Block;

});
#if NETCOREAPP3_1 || NET5_0
#if NETCOREAPP3_1 || NET5_0 || NET6_0
services.AddControllers()
.AddNewtonsoftJson()
#else
Expand All @@ -43,7 +43,7 @@ public void ConfigureServices(IServiceCollection services)

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app,
#if NETCOREAPP3_1|| NET5_0
#if NETCOREAPP3_1|| NET5_0 || NET6_0
IWebHostEnvironment env
#else
IHostingEnvironment env
Expand All @@ -54,7 +54,7 @@ IHostingEnvironment env
{
app.UseDeveloperExceptionPage();
}
#if NETCOREAPP3_1 || NET5_0
#if NETCOREAPP3_1 || NET5_0 || NET6_0
app.UseRouting();

app.UseEndpoints(endpoints =>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/Tests.Functional/Setup/TestServerSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class TestServerSetup : IDisposable
public TestServerSetup()
{
Server = new TestServer(Program.CreateWebHostBuilder(Array.Empty<string>())
#if NETCOREAPP3_1 || NET5_0
#if NETCOREAPP3_1 || NET5_0 || NET6_0
.UseTestServer()
#endif
.UseStartup<Startup>()
Expand Down
11 changes: 5 additions & 6 deletions src/tests/Tests.Functional/Tests.Functional.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Build">
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn);1573;1591;CS1591</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
<PackageReference Include="FluentAssertions" Version="5.10.3" />
Expand All @@ -26,10 +21,14 @@
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="3.1.9" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net5'">
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="5.0.5" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.0-preview.3.*" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\lib\Alphacloud.MessagePack.AspNetCore.Formatters\Alphacloud.MessagePack.AspNetCore.Formatters.csproj" />
<ProjectReference Include="..\..\lib\Alphacloud.MessagePack.HttpFormatter\Alphacloud.MessagePack.HttpFormatter.csproj" />
Expand Down

0 comments on commit f9662d1

Please sign in to comment.