Skip to content

Commit 6f021fe

Browse files
Merge pull request #36 from elsupergomez/update-aspnetcore-to-3.0
Update AspNetCore to 3.x
2 parents 867134e + 6b0f2c3 commit 6f021fe

File tree

4 files changed

+43
-8
lines changed

4 files changed

+43
-8
lines changed

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
os: Visual Studio 2017
1+
os: Visual Studio 2019
22

3-
version: 2.2.0-alpha-{build}
3+
version: 2.2.1-alpha-{build}
44

55
nuget:
66
project_feed: true

src/MakingSense.AspNetCore.HypermediaApi/Formatters/HypermediaApiJsonInputFormatter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
using Microsoft.Extensions.ObjectPool;
77
using Newtonsoft.Json;
88

9+
#if NETCOREAPP3_0 || NETCOREAPP3_1
10+
using MvcJsonOptions = Microsoft.AspNetCore.Mvc.MvcNewtonsoftJsonOptions;
11+
using JsonInputFormatter = Microsoft.AspNetCore.Mvc.Formatters.NewtonsoftJsonInputFormatter;
12+
#endif
13+
914
namespace MakingSense.AspNetCore.HypermediaApi.Formatters
1015
{
1116
// TODO: it is difficult to personalize it. Find an alternative.

src/MakingSense.AspNetCore.HypermediaApi/Formatters/Internal/HypermediaApiMvcOptionsSetup.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
using Microsoft.Extensions.Options;
88
using Newtonsoft.Json;
99

10+
#if NETCOREAPP3_0 || NETCOREAPP3_1
11+
using MvcJsonOptions = Microsoft.AspNetCore.Mvc.MvcNewtonsoftJsonOptions;
12+
#endif
13+
1014
namespace MakingSense.AspNetCore.HypermediaApi.Formatters.Internal
1115
{
1216
public class HypermediaApiMvcOptionsSetup : ConfigureOptions<MvcOptions>
@@ -40,7 +44,17 @@ public static void ConfigureMvc(
4044
serializerSettings.DateParseHandling = DateParseHandling.None;
4145

4246
options.OutputFormatters.Clear();
43-
options.OutputFormatters.Add(new JsonOutputFormatter(serializerSettings, charPool));
47+
48+
var jsonOutputFormatter =
49+
#if NETCOREAPP3_0 || NETCOREAPP3_1
50+
new NewtonsoftJsonOutputFormatter(serializerSettings, charPool, options);
51+
#elif NETSTANDARD2_0
52+
new JsonOutputFormatter(serializerSettings, charPool);
53+
#else
54+
#error unknown target framework
55+
#endif
56+
57+
options.OutputFormatters.Add(jsonOutputFormatter);
4458

4559
options.InputFormatters.Clear();
4660
var jsonInputLogger = loggerFactory.CreateLogger<HypermediaApiJsonInputFormatter>();

src/MakingSense.AspNetCore.HypermediaApi/MakingSense.AspNetCore.HypermediaApi.csproj

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,41 @@
33
<PropertyGroup>
44
<Description>MakingSense.AspNetCore.HypermediaApi Class Library</Description>
55
<Authors>MakingSense</Authors>
6-
<TargetFramework>netstandard2.0</TargetFramework>
6+
<TargetFrameworks>netcoreapp3.1;netcoreapp3.0;netstandard2.0</TargetFrameworks>
77
<AssemblyName>MakingSense.AspNetCore.HypermediaApi</AssemblyName>
88
<PackageId>MakingSense.AspNetCore.HypermediaApi</PackageId>
99
<PackageTags>ASP.NET 5;vnext;Hypermedia;API;REST;ASP.NET Core</PackageTags>
1010
<PackageProjectUrl>https://github.com/MakingSense/aspnet-hypermedia-api</PackageProjectUrl>
1111
<PackageLicenseUrl>http://www.gnu.org/licenses/lgpl.html</PackageLicenseUrl>
1212
<RepositoryType>git</RepositoryType>
1313
<RepositoryUrl>git://github.com/MakingSense/aspnet-hypermedia-api</RepositoryUrl>
14-
<VersionPrefix>2.2.0-alpha</VersionPrefix>
14+
<VersionPrefix>2.2.1-alpha</VersionPrefix>
1515
</PropertyGroup>
1616

1717
<ItemGroup>
1818
<ProjectReference Include="..\MakingSense.AspNetCore.Abstractions\MakingSense.AspNetCore.Abstractions.csproj" />
1919
</ItemGroup>
2020

21-
<ItemGroup>
21+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
22+
<FrameworkReference Include="Microsoft.AspNetCore.App" />
23+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson">
24+
<Version>3.1.0</Version>
25+
</PackageReference>
26+
</ItemGroup>
27+
28+
29+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
30+
<FrameworkReference Include="Microsoft.AspNetCore.App" />
31+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson">
32+
<Version>3.0.0</Version>
33+
</PackageReference>
34+
</ItemGroup>
35+
36+
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
2237
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
23-
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
24-
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
38+
</ItemGroup>
39+
40+
<ItemGroup>
2541
<PackageReference Include="System.Linq" Version="4.3.0" />
2642
<PackageReference Include="System.Linq.Queryable" Version="4.3.0" />
2743
<PackageReference Include="System.Threading" Version="4.3.0" />

0 commit comments

Comments
 (0)