Skip to content

Commit

Permalink
Updates for .NET 5
Browse files Browse the repository at this point in the history
  • Loading branch information
shaynevanasperen committed Nov 10, 2020
1 parent eb3088b commit 69956a0
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 21 deletions.
8 changes: 4 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Condition="$(NotNCrunch)" Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0" PrivateAssets="All" />
<PackageReference Condition="$(NotNCrunch)" Include="Microsoft.CodeQuality.Analyzers" Version="3.3.0" PrivateAssets="All" />
<PackageReference Condition="$(NotNCrunch)" Include="Microsoft.NetCore.Analyzers" Version="3.3.0" PrivateAssets="All" />
<PackageReference Condition="$(NotNCrunch)" Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.1" PrivateAssets="All" />
<PackageReference Condition="$(NotNCrunch)" Include="Microsoft.CodeQuality.Analyzers" Version="3.3.1" PrivateAssets="All" />
<PackageReference Condition="$(NotNCrunch)" Include="Microsoft.NetCore.Analyzers" Version="3.3.1" PrivateAssets="All" />
<PackageReference Condition="$(NotNCrunch) AND $(IsPackable)" Include="MinVer" Version="2.3.1" PrivateAssets="All" />
<PackageReference Condition="$(NotNCrunch) AND $(IsPackable)" Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Condition="$(IsTestProject)" Include="FluentAssertions" Version="5.10.3" />
<PackageReference Condition="$(IsTestProject)" Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Condition="$(IsTestProject)" Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
<PackageReference Condition="$(IsTestProject)" Include="NSubstitute" Version="4.2.2" />
<PackageReference Condition="$(IsTestProject)" Include="Serilog" Version="2.10.0" />
<PackageReference Condition="$(IsTestProject)" Include="Specify" Version="2.4.0" />
Expand Down
2 changes: 1 addition & 1 deletion samples/Samples.Tests/Samples.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
7 changes: 2 additions & 5 deletions samples/Samples/Domain/JsonPlaceHolderHttpClient.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using System.Net;
using System.Net.Http;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace Samples.Domain
{
Expand All @@ -20,17 +20,14 @@ public JsonPlaceHolderHttpClient(HttpClient httpClient)
public async Task<T> GetAsync<T>(string requestUri, CancellationToken cancellationToken = default)
{
var response = await _httpClient.GetAsync(requestUri, cancellationToken);
var content = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<T>(content);
return await JsonSerializer.DeserializeAsync<T>(await response.Content.ReadAsStreamAsync(cancellationToken), new(JsonSerializerDefaults.Web), cancellationToken);
}

#pragma warning disable CA1822 // Mark members as static
#pragma warning disable CA1801 // Review unused parameters
#pragma warning disable IDE0060 // Remove unused parameter
public Task<HttpResponseMessage> PostAsync<T>(string requestUri, T data, CancellationToken cancellationToken = default) =>
#pragma warning restore IDE0060 // Remove unused parameter
#pragma warning restore CA1801 // Review unused parameters
#pragma warning restore CA1822 // Mark members as static
Task.FromResult(new HttpResponseMessage(HttpStatusCode.NoContent));
}
}
6 changes: 2 additions & 4 deletions samples/Samples/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.AspNetCore;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;

namespace Samples
Expand All @@ -7,8 +7,6 @@ public sealed class Program
{
public static void Main(string[] args) => CreateWebHostBuilder(args).Build().Run();

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args).UseStartup<Startup>();
}
}
4 changes: 2 additions & 2 deletions samples/Samples/Samples.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
<NoWarn>$(NoWarn);CA1054;CA1062;CA1819;CA2007;CA2234</NoWarn>
</PropertyGroup>

Expand All @@ -12,7 +12,7 @@
<ItemGroup>
<PackageReference Include="BuildBundlerMinifier" Version="3.2.449" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.15.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="5.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/Magneto/Magneto.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
Expand All @@ -10,9 +10,9 @@
<PackageReference Include="Code.Extensions.Generic.QuasiEquals" Version="1.0.1" PrivateAssets="All" />
<PackageReference Include="Code.Extensions.Object.Flatten" Version="1.0.3" PrivateAssets="All" />
<PackageReference Include="Code.Extensions.ValueTuple.ServiceProvider" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="3.1.9" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.9" />
<PackageReference Include="System.Text.Json" Version="5.0.0-rc.2.20475.5" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="5.0.0" />
<PackageReference Condition="'$(TargetFramework)' == 'net461'" Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion test/Magneto.Tests/Magneto.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 69956a0

Please sign in to comment.