From 2855145d8a95768472849cb4fd99caf8b29a1014 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Fri, 28 May 2021 09:38:24 +1000 Subject: [PATCH] Net6 support (#538) --- .gitattributes | 1 + .../ApprovalTests.MSTest.csproj | 2 +- .../ApprovalTests.Tests.csproj | 2 +- src/ApprovalTests.Tests/Email/EmailTest.cs | 3 +- src/ApprovalTests.Tests/RunMaintenance.cs | 2 ++ .../ApprovalTests.Xunit2.csproj | 2 +- .../ApprovalUtilities.Tests.csproj | 6 ++-- .../AssembliesExistInBin.csproj | 2 +- .../AssembliesExistInNuget.csproj | 2 +- src/appveyor.yml | 29 ++++++++++++++----- src/global.json | 7 +++++ 11 files changed, 43 insertions(+), 15 deletions(-) create mode 100644 src/global.json diff --git a/.gitattributes b/.gitattributes index a640837a..f509a1ca 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,6 @@ # Auto detect text files and perform LF normalization * text eol=crlf +*.json -text # Custom for Visual Studio *.cs diff=csharp diff --git a/src/ApprovalTests.MSTest/ApprovalTests.MSTest.csproj b/src/ApprovalTests.MSTest/ApprovalTests.MSTest.csproj index de07b1cf..4f80a3e5 100644 --- a/src/ApprovalTests.MSTest/ApprovalTests.MSTest.csproj +++ b/src/ApprovalTests.MSTest/ApprovalTests.MSTest.csproj @@ -1,7 +1,7 @@  - net48;netcoreapp3.1 + net48;net6 diff --git a/src/ApprovalTests.Tests/ApprovalTests.Tests.csproj b/src/ApprovalTests.Tests/ApprovalTests.Tests.csproj index 6df916fd..6347b41c 100644 --- a/src/ApprovalTests.Tests/ApprovalTests.Tests.csproj +++ b/src/ApprovalTests.Tests/ApprovalTests.Tests.csproj @@ -1,7 +1,7 @@  - net48;netcoreapp3.1 + net48;net6 diff --git a/src/ApprovalTests.Tests/Email/EmailTest.cs b/src/ApprovalTests.Tests/Email/EmailTest.cs index 138562fc..99b0eebd 100644 --- a/src/ApprovalTests.Tests/Email/EmailTest.cs +++ b/src/ApprovalTests.Tests/Email/EmailTest.cs @@ -28,6 +28,7 @@ public void Testname() } } + #if(NET48) [Test] public void TestAttachment() { @@ -43,13 +44,13 @@ public void TestAttachment() EmailApprovals.Verify(message); } } + #endif [Test] public void TestCollectBoundaries() { var text = @"Content-Type: multipart/mixed; boundary=--boundary_1_f3c617c1-4388-492c-8e07-0ef9bdb8af93 - ----boundary_1_f3c617c1-4388-492c-8e07-0ef9bdb8af93 Content-Type: multipart/alternative; boundary=--boundary_0_283b02d8-4af3-4d14-83bd-6d7181499f83 diff --git a/src/ApprovalTests.Tests/RunMaintenance.cs b/src/ApprovalTests.Tests/RunMaintenance.cs index c0e0660e..3f91658b 100644 --- a/src/ApprovalTests.Tests/RunMaintenance.cs +++ b/src/ApprovalTests.Tests/RunMaintenance.cs @@ -3,6 +3,7 @@ namespace ApprovalTests.Tests { + #if(NET48) [TestFixture] public class RunMaintenance { @@ -23,4 +24,5 @@ public void EnsureNoAbandonedFiles() ); } } + #endif } \ No newline at end of file diff --git a/src/ApprovalTests.Xunit2/ApprovalTests.Xunit2.csproj b/src/ApprovalTests.Xunit2/ApprovalTests.Xunit2.csproj index eb558dac..1f5df461 100644 --- a/src/ApprovalTests.Xunit2/ApprovalTests.Xunit2.csproj +++ b/src/ApprovalTests.Xunit2/ApprovalTests.Xunit2.csproj @@ -1,7 +1,7 @@  - net48;netcoreapp3.1 + net48;net6 diff --git a/src/ApprovalUtilities.Tests/ApprovalUtilities.Tests.csproj b/src/ApprovalUtilities.Tests/ApprovalUtilities.Tests.csproj index 788f2b53..6a724077 100644 --- a/src/ApprovalUtilities.Tests/ApprovalUtilities.Tests.csproj +++ b/src/ApprovalUtilities.Tests/ApprovalUtilities.Tests.csproj @@ -1,7 +1,7 @@  - net48;netcoreapp3.1 + net48;net5;net6 @@ -11,9 +11,11 @@ - + + + diff --git a/src/AssembliesExistInBin/AssembliesExistInBin.csproj b/src/AssembliesExistInBin/AssembliesExistInBin.csproj index eb154577..5b48c7c5 100644 --- a/src/AssembliesExistInBin/AssembliesExistInBin.csproj +++ b/src/AssembliesExistInBin/AssembliesExistInBin.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6 diff --git a/src/AssembliesExistInNuget/AssembliesExistInNuget.csproj b/src/AssembliesExistInNuget/AssembliesExistInNuget.csproj index 0636b896..8d626f0c 100644 --- a/src/AssembliesExistInNuget/AssembliesExistInNuget.csproj +++ b/src/AssembliesExistInNuget/AssembliesExistInNuget.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6 false diff --git a/src/appveyor.yml b/src/appveyor.yml index a34891ba..5906d534 100644 --- a/src/appveyor.yml +++ b/src/appveyor.yml @@ -1,10 +1,25 @@ -image: Visual Studio 2019 +image: +- Visual Studio 2019 +#- macOS +#- Ubuntu build_script: -- ps: >- - dotnet build src\ApprovalUtilities\ApprovalUtilities.csproj --configuration Debug - - dotnet build src\ApprovalTests\ApprovalTests.csproj --configuration Debug - - dotnet build src --configuration Debug +# https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script +- pwsh: | + if ($isWindows) { + Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./dotnet-install.ps1" + ./dotnet-install.ps1 -JSonFile src/global.json -Architecture x64 -InstallDir 'C:\Program Files\dotnet' + } + else { + Invoke-WebRequest "https://dot.net/v1/dotnet-install.sh" -OutFile "./dotnet-install.sh" + sudo chmod u+x dotnet-install.sh + if ($isMacOS) { + sudo ./dotnet-install.sh --jsonfile src/global.json --architecture x64 --install-dir '/usr/local/share/dotnet' + } else { + sudo ./dotnet-install.sh --jsonfile src/global.json --architecture x64 --install-dir '/usr/share/dotnet' + } + } +- dotnet build src --configuration Debug +- dotnet test src --configuration Debug --no-build --no-restore +test: off artifacts: - path: nuget_packages\*.nupkg \ No newline at end of file diff --git a/src/global.json b/src/global.json new file mode 100644 index 00000000..dfeddec7 --- /dev/null +++ b/src/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "6.0.100-preview.4.21255.9", + "allowPrerelease": true, + "rollForward": "latestFeature" + } +} \ No newline at end of file