From 0914d1d01e534869ec4d8638236bec3f8340df75 Mon Sep 17 00:00:00 2001 From: Jason Finch Date: Mon, 12 Jun 2023 16:25:04 +1000 Subject: [PATCH 1/3] feat: Add Target Builds for net6.0, netstandard2.1. Bump packages --- Directory.Packages.props | 39 ++++++++++++------- SmartEnum.sln | 2 - .../SmartEnum.Benchmarks.csproj | 6 +-- .../SmartEnum.AutoFixture.csproj | 2 + src/SmartEnum.Dapper/SmartEnum.Dapper.csproj | 3 ++ src/SmartEnum.EFCore/SmartEnum.EFCore.csproj | 1 + .../SmartEnum.JsonNet.csproj | 4 +- .../SmartEnum.MessagePack.csproj | 2 + .../SmartEnum.ModelBinding.csproj | 8 ++-- .../SmartEnum.ProtoBufNet.csproj | 2 + .../SmartEnum.SystemTextJson.csproj | 2 + .../SmartEnum.Utf8Json.csproj | 2 + src/SmartEnum/SmartEnum.cs | 2 +- src/SmartEnum/SmartEnum.csproj | 2 + .../SmartEnum.AutoFixture.UnitTests.csproj | 4 +- .../SmartEnum.Dapper.IntegrationTests.csproj | 2 +- .../SmartEnum.Dapper.UnitTests.csproj | 6 ++- .../SmartEnum.JsonNet.UnitTests.csproj | 6 ++- .../SmartEnum.MessagePack.UnitTests.csproj | 4 +- .../SmartEnum.ProtoBufNet.UnitTests.csproj | 4 +- .../SmartEnum.SystemTextJson.UnitTests.csproj | 9 ++++- .../SmartEnum.UnitTests.csproj | 2 + .../SmartEnum.Utf8Json.UnitTests.csproj | 10 +++-- .../SmartFlagEnum.UnitTests.csproj | 8 ++-- 24 files changed, 90 insertions(+), 42 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 3fc24774..067a2d2a 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,27 +3,36 @@ true - - + + - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers + - - + + - - - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + - - - - + + + + diff --git a/SmartEnum.sln b/SmartEnum.sln index f5da9161..fb8c4c42 100644 --- a/SmartEnum.sln +++ b/SmartEnum.sln @@ -11,13 +11,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{E4 ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig .gitignore = .gitignore - azure-pipelines.yml = azure-pipelines.yml Directory.Build.props = Directory.Build.props Directory.Packages.props = Directory.Packages.props LICENSE = LICENSE nuget.txt = nuget.txt README.md = README.md - SmartEnumTests.ruleset = SmartEnumTests.ruleset EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SmartEnum.Benchmarks", "benchmarks\SmartEnum.Benchmarks\SmartEnum.Benchmarks.csproj", "{0F0C288D-39BA-4E83-A7FE-3B90D7CF250A}" diff --git a/benchmarks/SmartEnum.Benchmarks/SmartEnum.Benchmarks.csproj b/benchmarks/SmartEnum.Benchmarks/SmartEnum.Benchmarks.csproj index 02218d06..a6450fa8 100644 --- a/benchmarks/SmartEnum.Benchmarks/SmartEnum.Benchmarks.csproj +++ b/benchmarks/SmartEnum.Benchmarks/SmartEnum.Benchmarks.csproj @@ -6,9 +6,9 @@ false - - - + + + diff --git a/src/SmartEnum.AutoFixture/SmartEnum.AutoFixture.csproj b/src/SmartEnum.AutoFixture/SmartEnum.AutoFixture.csproj index 0f1cf9e9..7a8f0936 100644 --- a/src/SmartEnum.AutoFixture/SmartEnum.AutoFixture.csproj +++ b/src/SmartEnum.AutoFixture/SmartEnum.AutoFixture.csproj @@ -10,6 +10,8 @@ Updating to net7 Ardalis.SmartEnum.AutoFixture Ardalis.SmartEnum.AutoFixture + net7.0;net6.0;netstandard2.1 + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml diff --git a/src/SmartEnum.Dapper/SmartEnum.Dapper.csproj b/src/SmartEnum.Dapper/SmartEnum.Dapper.csproj index c81a5de9..d09909ac 100644 --- a/src/SmartEnum.Dapper/SmartEnum.Dapper.csproj +++ b/src/SmartEnum.Dapper/SmartEnum.Dapper.csproj @@ -7,9 +7,12 @@ enum;smartenum;dapper;ardalis Updating to net7. icon.png + 11.0 Ardalis.SmartEnum.Dapper Ardalis.SmartEnum.Dapper true + net7.0;net6.0;netstandard2.1 + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml diff --git a/src/SmartEnum.EFCore/SmartEnum.EFCore.csproj b/src/SmartEnum.EFCore/SmartEnum.EFCore.csproj index 2c6f8868..a54ba5b3 100644 --- a/src/SmartEnum.EFCore/SmartEnum.EFCore.csproj +++ b/src/SmartEnum.EFCore/SmartEnum.EFCore.csproj @@ -11,6 +11,7 @@ Ardalis.SmartEnum.EFCore Ardalis.SmartEnum.EFCore true + net6.0;net7.0 bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml diff --git a/src/SmartEnum.JsonNet/SmartEnum.JsonNet.csproj b/src/SmartEnum.JsonNet/SmartEnum.JsonNet.csproj index 40996a94..7f49c23e 100644 --- a/src/SmartEnum.JsonNet/SmartEnum.JsonNet.csproj +++ b/src/SmartEnum.JsonNet/SmartEnum.JsonNet.csproj @@ -9,12 +9,14 @@ icon.png Ardalis.SmartEnum.JsonNet Ardalis.SmartEnum.JsonNet + net7.0;net6.0;netstandard2.1 + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml - + diff --git a/src/SmartEnum.MessagePack/SmartEnum.MessagePack.csproj b/src/SmartEnum.MessagePack/SmartEnum.MessagePack.csproj index 159f4cb0..7803a591 100644 --- a/src/SmartEnum.MessagePack/SmartEnum.MessagePack.csproj +++ b/src/SmartEnum.MessagePack/SmartEnum.MessagePack.csproj @@ -9,6 +9,8 @@ icon.png Ardalis.SmartEnum.MessagePack Ardalis.SmartEnum.MessagePack + net7.0;net6.0;netstandard2.1 + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml diff --git a/src/SmartEnum.ModelBinding/SmartEnum.ModelBinding.csproj b/src/SmartEnum.ModelBinding/SmartEnum.ModelBinding.csproj index 5ac6d9ba..d0133ff5 100644 --- a/src/SmartEnum.ModelBinding/SmartEnum.ModelBinding.csproj +++ b/src/SmartEnum.ModelBinding/SmartEnum.ModelBinding.csproj @@ -9,15 +9,17 @@ icon.png Updating to net7. Ardalis.SmartEnum.ModelBinding + net7.0;net6.0;netstandard2.1 + - + - + - + diff --git a/src/SmartEnum.ProtoBufNet/SmartEnum.ProtoBufNet.csproj b/src/SmartEnum.ProtoBufNet/SmartEnum.ProtoBufNet.csproj index 2fc31bc4..1741782a 100644 --- a/src/SmartEnum.ProtoBufNet/SmartEnum.ProtoBufNet.csproj +++ b/src/SmartEnum.ProtoBufNet/SmartEnum.ProtoBufNet.csproj @@ -9,6 +9,8 @@ icon.png Ardalis.SmartEnum.ProtoBufNet Ardalis.SmartEnum.ProtoBufNet + net7.0;net6.0;netstandard2.1 + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml diff --git a/src/SmartEnum.SystemTextJson/SmartEnum.SystemTextJson.csproj b/src/SmartEnum.SystemTextJson/SmartEnum.SystemTextJson.csproj index 5abf1caa..cb173fb0 100644 --- a/src/SmartEnum.SystemTextJson/SmartEnum.SystemTextJson.csproj +++ b/src/SmartEnum.SystemTextJson/SmartEnum.SystemTextJson.csproj @@ -10,6 +10,8 @@ Updating to net7. Ardalis.SmartEnum.SystemTextJson Ardalis.SmartEnum.SystemTextJson + net7.0;net6.0;netstandard2.1 + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml diff --git a/src/SmartEnum.Utf8Json/SmartEnum.Utf8Json.csproj b/src/SmartEnum.Utf8Json/SmartEnum.Utf8Json.csproj index f1258f4c..382b2214 100644 --- a/src/SmartEnum.Utf8Json/SmartEnum.Utf8Json.csproj +++ b/src/SmartEnum.Utf8Json/SmartEnum.Utf8Json.csproj @@ -9,6 +9,8 @@ icon.png Ardalis.SmartEnum.Utf8Json Ardalis.SmartEnum.Utf8Json + net7.0;net6.0;netstandard2.1 + bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml diff --git a/src/SmartEnum/SmartEnum.cs b/src/SmartEnum/SmartEnum.cs index 84acccc4..f1c94c7d 100644 --- a/src/SmartEnum/SmartEnum.cs +++ b/src/SmartEnum/SmartEnum.cs @@ -356,7 +356,7 @@ public virtual int CompareTo(SmartEnum other) => [MethodImpl(MethodImplOptions.AggressiveInlining)] public static implicit operator TValue(SmartEnum smartEnum) => - smartEnum is not null + smartEnum != null ? smartEnum._value : default; diff --git a/src/SmartEnum/SmartEnum.csproj b/src/SmartEnum/SmartEnum.csproj index 3810730e..11cd9080 100644 --- a/src/SmartEnum/SmartEnum.csproj +++ b/src/SmartEnum/SmartEnum.csproj @@ -10,6 +10,8 @@ Updating to net7. Ardalis.SmartEnum README.md + net6.0;net7.0;netstandard2.1 + diff --git a/test/SmartEnum.AutoFixture.UnitTests/SmartEnum.AutoFixture.UnitTests.csproj b/test/SmartEnum.AutoFixture.UnitTests/SmartEnum.AutoFixture.UnitTests.csproj index 344d4866..b9f3ea18 100644 --- a/test/SmartEnum.AutoFixture.UnitTests/SmartEnum.AutoFixture.UnitTests.csproj +++ b/test/SmartEnum.AutoFixture.UnitTests/SmartEnum.AutoFixture.UnitTests.csproj @@ -4,6 +4,8 @@ false 7.3 strict + net7.0;net6.0 + @@ -16,7 +18,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers diff --git a/test/SmartEnum.Dapper.IntegrationTests/SmartEnum.Dapper.IntegrationTests.csproj b/test/SmartEnum.Dapper.IntegrationTests/SmartEnum.Dapper.IntegrationTests.csproj index 79aa5b6c..6513849e 100644 --- a/test/SmartEnum.Dapper.IntegrationTests/SmartEnum.Dapper.IntegrationTests.csproj +++ b/test/SmartEnum.Dapper.IntegrationTests/SmartEnum.Dapper.IntegrationTests.csproj @@ -8,7 +8,7 @@ - + all runtime; build; native; contentfiles; analyzers diff --git a/test/SmartEnum.Dapper.UnitTests/SmartEnum.Dapper.UnitTests.csproj b/test/SmartEnum.Dapper.UnitTests/SmartEnum.Dapper.UnitTests.csproj index 9ce67553..03ede56a 100644 --- a/test/SmartEnum.Dapper.UnitTests/SmartEnum.Dapper.UnitTests.csproj +++ b/test/SmartEnum.Dapper.UnitTests/SmartEnum.Dapper.UnitTests.csproj @@ -2,13 +2,15 @@ false Ardalis.SmartEnum.Dapper.UnitTests + net7.0;net6.0 + - + - + all runtime; build; native; contentfiles; analyzers diff --git a/test/SmartEnum.JsonNet.UnitTests/SmartEnum.JsonNet.UnitTests.csproj b/test/SmartEnum.JsonNet.UnitTests/SmartEnum.JsonNet.UnitTests.csproj index 5c7bcbb4..760a8062 100644 --- a/test/SmartEnum.JsonNet.UnitTests/SmartEnum.JsonNet.UnitTests.csproj +++ b/test/SmartEnum.JsonNet.UnitTests/SmartEnum.JsonNet.UnitTests.csproj @@ -3,6 +3,8 @@ false 7.3 strict + net7.0;net6.0 + @@ -10,11 +12,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers diff --git a/test/SmartEnum.MessagePack.UnitTests/SmartEnum.MessagePack.UnitTests.csproj b/test/SmartEnum.MessagePack.UnitTests/SmartEnum.MessagePack.UnitTests.csproj index 07f48265..a6989a79 100644 --- a/test/SmartEnum.MessagePack.UnitTests/SmartEnum.MessagePack.UnitTests.csproj +++ b/test/SmartEnum.MessagePack.UnitTests/SmartEnum.MessagePack.UnitTests.csproj @@ -1,8 +1,10 @@ false - 7.3 + 8 strict + net7.0;net6.0 + diff --git a/test/SmartEnum.ProtoBufNet.UnitTests/SmartEnum.ProtoBufNet.UnitTests.csproj b/test/SmartEnum.ProtoBufNet.UnitTests/SmartEnum.ProtoBufNet.UnitTests.csproj index 962a7f17..78bf2970 100644 --- a/test/SmartEnum.ProtoBufNet.UnitTests/SmartEnum.ProtoBufNet.UnitTests.csproj +++ b/test/SmartEnum.ProtoBufNet.UnitTests/SmartEnum.ProtoBufNet.UnitTests.csproj @@ -1,8 +1,10 @@ false - 7.3 + 8 strict + net7.0;net6.0 + diff --git a/test/SmartEnum.SystemTextJson.UnitTests/SmartEnum.SystemTextJson.UnitTests.csproj b/test/SmartEnum.SystemTextJson.UnitTests/SmartEnum.SystemTextJson.UnitTests.csproj index 71be89b6..7afc4bef 100644 --- a/test/SmartEnum.SystemTextJson.UnitTests/SmartEnum.SystemTextJson.UnitTests.csproj +++ b/test/SmartEnum.SystemTextJson.UnitTests/SmartEnum.SystemTextJson.UnitTests.csproj @@ -1,15 +1,20 @@ + + net7.0;net6.0 + + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers diff --git a/test/SmartEnum.UnitTests/SmartEnum.UnitTests.csproj b/test/SmartEnum.UnitTests/SmartEnum.UnitTests.csproj index 71d62475..1fa83513 100644 --- a/test/SmartEnum.UnitTests/SmartEnum.UnitTests.csproj +++ b/test/SmartEnum.UnitTests/SmartEnum.UnitTests.csproj @@ -3,6 +3,8 @@ false 7.3 strict + net7.0;net6.0 + diff --git a/test/SmartEnum.Utf8Json.UnitTests/SmartEnum.Utf8Json.UnitTests.csproj b/test/SmartEnum.Utf8Json.UnitTests/SmartEnum.Utf8Json.UnitTests.csproj index ee5f7a16..95370a65 100644 --- a/test/SmartEnum.Utf8Json.UnitTests/SmartEnum.Utf8Json.UnitTests.csproj +++ b/test/SmartEnum.Utf8Json.UnitTests/SmartEnum.Utf8Json.UnitTests.csproj @@ -1,26 +1,28 @@ false - 7.3 + 8 strict + net7.0;net6.0 + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers - + all runtime; build; native; contentfiles; analyzers diff --git a/test/SmartFlagEnum.UnitTests/SmartFlagEnum.UnitTests.csproj b/test/SmartFlagEnum.UnitTests/SmartFlagEnum.UnitTests.csproj index 4910da45..5e83d82f 100644 --- a/test/SmartFlagEnum.UnitTests/SmartFlagEnum.UnitTests.csproj +++ b/test/SmartFlagEnum.UnitTests/SmartFlagEnum.UnitTests.csproj @@ -2,14 +2,16 @@ false + net7.0;net6.0 + - - + + - + all runtime; build; native; contentfiles; analyzers From 31e08bc7f623855056592fbcc9e92b5fbc486088 Mon Sep 17 00:00:00 2001 From: Jason Finch Date: Mon, 12 Jun 2023 16:31:14 +1000 Subject: [PATCH 2/3] task: Add basic build/test pipeline --- .github/workflows/build.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..4fdc62a5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,25 @@ +name: Build-Test + +on: + push: + branches: [ "*" ] + pull_request: + branches: [ "*" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 7.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal From 83e0c8d589c0e477e7cdbfc534fc2b1c56b259f1 Mon Sep 17 00:00:00 2001 From: Jason Finch Date: Mon, 12 Jun 2023 16:51:21 +1000 Subject: [PATCH 3/3] docs: Update readme regarding multi-targeting. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 32822159..1d6d1cdc 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,8 @@ Install-Package Ardalis.SmartEnum.Dapper ## Version -The latest version of the package supports .NET 7. If you don't need or aren't yet ready to move to .NET 7 or later, you should install the previous stable version, [Ardalis.SmartEnum 2.1](https://www.nuget.org/packages/Ardalis.SmartEnum/2.1.0). +The latest version of the package multi-targets `.NET7`, `.NET6` and `.NetStandard2.1` (Excluding the EFCore package which is incompatbile with .NetStandard 2.1). +If you don't need or aren't yet ready to move to .NET 7 or later, you should install the previous stable version, [Ardalis.SmartEnum 2.1](https://www.nuget.org/packages/Ardalis.SmartEnum/2.1.0). Example package manager command: