Skip to content

Commit

Permalink
Build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
thompson-tomo committed Apr 18, 2024
1 parent bd9b194 commit 027aeaf
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 33 deletions.
3 changes: 0 additions & 3 deletions JWT.sln
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{44284230
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C86A941F-F655-4EF5-A6A1-47BD4A7FC748}"
ProjectSection(SolutionItems) = preProject
src\Directory.Build.targets = src\Directory.Build.targets
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JWT.Tests.Net70", "tests\JWT.Tests.Net70\JWT.Tests.Net70.csproj", "{D7F24AC9-D178-4BAB-BF93-4BAD8028416D}"
EndProject
Expand Down
11 changes: 0 additions & 11 deletions src/Directory.Build.targets

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworkIdentifier>.NETStandard</TargetFrameworkIdentifier>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down Expand Up @@ -31,7 +30,10 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.32" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="System.Text.Json" Version="6.0.7" Condition="$(DefineConstants.Contains(MODERN_DOTNET))" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="System.Text.Json" Version="6.0.7" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/JWT/Builder/JwtBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using JWT.Serializers;
using Newtonsoft.Json;

#if MODERN_DOTNET
#if NET462_OR_GREATER || NET6_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
using System.Text.Json.Serialization;
#endif

Expand Down Expand Up @@ -489,7 +489,7 @@ private string GetPropName(MemberInfo prop)
}
break;
}
#if MODERN_DOTNET
#if NET462_OR_GREATER || NET6_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
case SystemTextSerializer:
{
if (attribute is JsonPropertyNameAttribute stjProperty)
Expand Down
20 changes: 10 additions & 10 deletions src/JWT/Builder/JwtHeader.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if MODERN_DOTNET
#if NET462_OR_GREATER || NET6_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
using System.Text.Json.Serialization;
#endif

Expand All @@ -11,50 +11,50 @@ namespace JWT.Builder
/// </summary>
public class JwtHeader
{
#if MODERN_DOTNET
#if NET462_OR_GREATER || NET6_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
[System.Text.Json.Serialization.JsonConstructor]
public JwtHeader()
{
}
#endif
#endif
[JsonProperty("typ")]
#if MODERN_DOTNET
#if NET462_OR_GREATER || NET6_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
[JsonPropertyName("typ")]
#endif
public string Type { get; set; }

[JsonProperty("cty")]
#if MODERN_DOTNET
#if NET462_OR_GREATER || NET6_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
[JsonPropertyName("cty")]
#endif
public string ContentType { get; set; }

[JsonProperty("alg")]
#if MODERN_DOTNET
#if NET462_OR_GREATER || NET6_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
[JsonPropertyName("alg")]
#endif
public string Algorithm { get; set; }

[JsonProperty("kid")]
#if MODERN_DOTNET
#if NET462_OR_GREATER || NET6_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
[JsonPropertyName("kid")]
#endif
public string KeyId { get; set; }

[JsonProperty("x5u")]
#if MODERN_DOTNET
#if NET462_OR_GREATER || NET6_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
[JsonPropertyName("x5u")]
#endif
public string X5u { get; set; }

[JsonProperty("x5c")]
#if MODERN_DOTNET
#if NET462_OR_GREATER || NET6_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
[JsonPropertyName("x5c")]
#endif
public string[] X5c { get; set; }

[JsonProperty("x5t")]
#if MODERN_DOTNET
#if NET462_OR_GREATER || NET6_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
[JsonPropertyName("x5t")]
#endif
public string X5t { get; set; }
Expand Down
3 changes: 2 additions & 1 deletion src/JWT/JWT.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Text.Json" Version="6.0.7" />
</ItemGroup>

Expand All @@ -53,6 +53,7 @@
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" />
<PackageReference Include="System.Security.Cryptography.Csp" Version="4.3.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net35'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2">
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if MODERN_DOTNET
#if NET462_OR_GREATER || NET6_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
using System;
using System.Collections.Generic;
using System.Text.Json;
Expand Down
2 changes: 1 addition & 1 deletion src/JWT/Serializers/DefaultJsonSerializerFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public sealed class DefaultJsonSerializerFactory : IJsonSerializerFactory

public DefaultJsonSerializerFactory()
{
#if MODERN_DOTNET
#if NET462_OR_GREATER || NET6_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
_jsonSerializer = new SystemTextSerializer();
#else
_jsonSerializer = new JsonNetSerializer();
Expand Down
2 changes: 1 addition & 1 deletion src/JWT/Serializers/SystemTextSerializer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if MODERN_DOTNET
#if NET462_OR_GREATER || NET6_0_OR_GREATER || NETSTANDARD2_0_OR_GREATER
using System;
using System.Text.Json;
using JWT.Serializers.Converters;
Expand Down

0 comments on commit 027aeaf

Please sign in to comment.