Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added .Net6 target framework #674

Merged
merged 9 commits into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: csharp
dist: xenial
dotnet: 5.0.100
dotnet: 6.0.100
mono: none
env: CONFIGURATION=Release FRAMEWORK=net5.0
env: CONFIGURATION=Release FRAMEWORK=net6.0

before_script:
- dotnet --info
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<PropertyGroup>
<TargetIsNetFx Condition="$(TargetFramework.StartsWith('net4'))">true</TargetIsNetFx>
<TargetIsNet5 Condition="'$(TargetFramework)' == 'net5.0'">true</TargetIsNet5>
<TargetIsNet5OrNewer Condition="'$(TargetFramework)' == 'net5.0' Or '$(TargetFramework)' == 'net6.0'">true</TargetIsNet5OrNewer>
<LangVersion>latest</LangVersion>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
os: Visual Studio 2019
os: Visual Studio 2022
build: off

environment:
Expand Down
32 changes: 16 additions & 16 deletions src/NSubstitute/NSubstitute.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>
<Description>NSubstitute is a friendly substitute for .NET mocking libraries. It has a simple, succinct syntax to help developers write clearer tests. NSubstitute is designed for Arrange-Act-Assert (AAA) testing and with Test Driven Development (TDD) in mind.</Description>
Expand All @@ -16,9 +16,19 @@
</ItemGroup>

<PropertyGroup>
<TargetFrameworks>netstandard1.3;netstandard2.0;net45;net46;net5.0</TargetFrameworks>
<TargetFrameworks>netstandard1.3;netstandard2.0;net45;net46;net5.0;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="System.Linq.Queryable" Version="4.3.0-*" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0-*" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' != 'netstandard1.3' ">
<DefineConstants>$(DefineConstants);SYSTEM_REFLECTION_CUSTOMATTRIBUTES_IS_ARRAY</DefineConstants>
</PropertyGroup>


<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
Expand All @@ -34,28 +44,18 @@
</PropertyGroup>

<PropertyGroup>
<Nullable Condition="'$(TargetIsNet5)' == 'true'">enable</Nullable>
<Nullable Condition="'$(TargetIsNet5OrNewer)' == 'true'">enable</Nullable>
<!-- Nullability does not work nicely for older versions of .NET, so just disable nullability for those versions. -->
<!-- CS8632 - The annotation for nullable reference types should only be used in code within a '#nullable' annotations context. -->
<NoWarn Condition="'$(TargetIsNet5)' != 'true'">$(NoWarn);CS8632</NoWarn>
<NoWarn Condition="'$(TargetIsNet5OrNewer)' != 'true'">$(NoWarn);CS8632</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Castle.Core" Version="4.4.1-*" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.3.0-*"
Condition="'$(TargetIsNet5)' != 'true'" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.3.0-*" Condition="'$(TargetIsNet5OrNewer)' != 'true'" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="System.Linq.Queryable" Version="4.3.0-*" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0-*" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' != 'netstandard1.3' ">
<DefineConstants>$(DefineConstants);SYSTEM_REFLECTION_CUSTOMATTRIBUTES_IS_ARRAY</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetIsNet5)' == 'true'">
<PropertyGroup Condition="'$(TargetIsNet5OrNewer)' == 'true'">
<DefineConstants>$(DefineConstants);SYSTEM_DIAGNOSTICS_CODEANALYSIS_NULLABILITY</DefineConstants>
</PropertyGroup>

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

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;netcoreapp1.1;net46;net45;net5.0</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;net46;net45;net5.0;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetIsNetFx)' == 'true'">
Expand Down
1 change: 0 additions & 1 deletion tests/NSubstitute.Benchmarks/ActivationBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using NSubstitute.Benchmarks.TestTypes;

namespace NSubstitute.Benchmarks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using NSubstitute.Benchmarks.TestTypes;

namespace NSubstitute.Benchmarks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using NSubstitute.Benchmarks.TestTypes;
using NSubstitute.Core;

namespace NSubstitute.Benchmarks
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using NSubstitute.Benchmarks.TestTypes;
using NSubstitute.Core;

namespace NSubstitute.Benchmarks
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using NSubstitute.Benchmarks.TestTypes;

namespace NSubstitute.Benchmarks
Expand Down
5 changes: 3 additions & 2 deletions tests/NSubstitute.Benchmarks/NSubstitute.Benchmarks.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net462;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net6.0</TargetFrameworks>
<StartupObject>NSubstitute.Benchmarks.Program</StartupObject>
Havunen marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>

<ItemGroup>
Expand All @@ -11,7 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.10.14" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.1" />
<ProjectReference Include="..\..\src\NSubstitute\NSubstitute.csproj" />
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion tests/NSubstitute.Benchmarks/ToStringCallBenchmark.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using NSubstitute.Benchmarks.TestTypes;

namespace NSubstitute.Benchmarks
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using NSubstitute.Benchmarks.TestTypes;

namespace NSubstitute.Benchmarks
Expand Down