Skip to content

Commit

Permalink
Add net6 TFM
Browse files Browse the repository at this point in the history
  • Loading branch information
jnyrup committed Mar 5, 2022
1 parent 418a405 commit eed763b
Show file tree
Hide file tree
Showing 16 changed files with 2,721 additions and 23 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Expand Up @@ -28,6 +28,7 @@ jobs:
2.1.x
3.1.x
5.0.x
6.0.x
- name: Run NUKE
run: ./build.ps1
Expand Down
4 changes: 2 additions & 2 deletions Build/Build.cs
Expand Up @@ -42,7 +42,7 @@ class Build : NukeBuild
[Solution(GenerateProjects = true)]
readonly Solution Solution;

[GitVersion(Framework = "net5.0")]
[GitVersion(Framework = "net6.0")]
readonly GitVersion GitVersion;

[PackageExecutable("nspec", "NSpecRunner.exe", Version = "3.1.0")]
Expand Down Expand Up @@ -159,7 +159,7 @@ class Build : NukeBuild
.Executes(() =>
{
ReportGenerator(s => s
.SetProcessToolPath(ToolPathResolver.GetPackageExecutable("ReportGenerator", "ReportGenerator.dll", framework: "net5.0"))
.SetProcessToolPath(ToolPathResolver.GetPackageExecutable("ReportGenerator", "ReportGenerator.dll", framework: "net6.0"))
.SetTargetDirectory(RootDirectory / "TestResults" / "reports")
.AddReports(RootDirectory / "TestResults/**/coverage.cobertura.xml")
.AddReportTypes("HtmlInline_AzurePipelines_Dark", "lcov")
Expand Down
2 changes: 1 addition & 1 deletion Build/_build.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..\</NukeRootDirectory>
Expand Down
2 changes: 1 addition & 1 deletion Src/FluentAssertions/Execution/AssertionScope.cs
Expand Up @@ -23,6 +23,7 @@ public sealed class AssertionScope : IAssertionScope
private readonly FormattingOptions formattingOptions = AssertionOptions.FormattingOptions.Clone();
private readonly IAssertionStrategy assertionStrategy;
private readonly ContextDataItems contextData = new();
private readonly StringBuilder tracing = new();

private Func<string> reason;

Expand All @@ -32,7 +33,6 @@ public sealed class AssertionScope : IAssertionScope
private Func<string> expectation;
private string fallbackIdentifier = "object";
private bool? succeeded;
private readonly StringBuilder tracing = new();

private sealed class DeferredReportable
{
Expand Down
13 changes: 8 additions & 5 deletions Src/FluentAssertions/FluentAssertions.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<!-- To reduce build times, we only enable analyzers for the newest TFM -->
<PropertyGroup>
<TargetFrameworks>net47;netcoreapp2.1;netcoreapp3.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net47;net6.0;netcoreapp2.1;netcoreapp3.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>FluentAssertions.snk</AssemblyOriginatorKeyFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down Expand Up @@ -31,7 +31,7 @@
<Copyright>Copyright Dennis Doomen 2010-2020</Copyright>
<LangVersion>9.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<PropertyGroup Condition="'$(TargetFramework)' != 'net6.0'">
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
<RunAnalyzersDuringLiveAnalysis>false</RunAnalyzersDuringLiveAnalysis>
<RunAnalyzers>false</RunAnalyzers>
Expand Down Expand Up @@ -65,10 +65,10 @@
<ItemGroup Condition=" !('$(TargetFramework)' == 'net47' Or '$(TargetFramework)' == 'netstandard2.0') ">
<Compile Remove="SystemExtensions.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net47' Or '$(TargetFramework)' == 'netcoreapp2.1' Or '$(TargetFramework)' == 'netcoreapp3.0' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net47' Or '$(TargetFramework)' == 'netcoreapp2.1' Or '$(TargetFramework)' == 'netcoreapp3.0' Or '$(TargetFramework)' == 'net6.0' ">
<Compile Remove="Common/NullConfigurationStore.cs" />
</ItemGroup>
<ItemGroup Condition=" !('$(TargetFramework)' == 'net47' Or '$(TargetFramework)' == 'netcoreapp2.1' Or '$(TargetFramework)' == 'netcoreapp3.0') ">
<ItemGroup Condition=" !('$(TargetFramework)' == 'net47' Or '$(TargetFramework)' == 'netcoreapp2.1' Or '$(TargetFramework)' == 'netcoreapp3.0' Or '$(TargetFramework)' == 'net6.0') ">
<Compile Remove="Common/AppSettingsConfigurationStore.cs" />
<Compile Remove="Common/ConfigurationStoreExceptionInterceptor.cs" />
</ItemGroup>
Expand All @@ -83,6 +83,9 @@
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net47'">
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
Expand All @@ -91,7 +94,7 @@
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
2 changes: 2 additions & 0 deletions Src/FluentAssertions/ObjectAssertionsExtensions.cs
Expand Up @@ -147,9 +147,11 @@ private static object CreateCloneUsingBinarySerializer(object subject)
Binder = new SimpleBinder(subject.GetType())
};

#pragma warning disable SYSLIB0011 // BinaryFormatter is obsoleted, GH-issue 1779 tracks the upcoming removal in .NET 8.0
binaryFormatter.Serialize(stream, subject);
stream.Position = 0;
return binaryFormatter.Deserialize(stream);
#pragma warning restore SYSLIB0011
}

private class SimpleBinder : SerializationBinder
Expand Down
1 change: 0 additions & 1 deletion Src/FluentAssertions/StringSyntaxAttribute.cs
Expand Up @@ -2,7 +2,6 @@
#if !NET7_0_OR_GREATER
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#nullable enable

namespace System.Diagnostics.CodeAnalysis
Expand Down
1 change: 1 addition & 0 deletions Tests/Approval.Tests/ApiApproval.cs
Expand Up @@ -19,6 +19,7 @@ public class ApiApproval
{
[Theory]
[InlineData("net47")]
[InlineData("net6.0")]
[InlineData("netstandard2.0")]
[InlineData("netstandard2.1")]
[InlineData("netcoreapp2.1")]
Expand Down
2 changes: 1 addition & 1 deletion Tests/Approval.Tests/Approval.Tests.csproj
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit eed763b

Please sign in to comment.