From 6e71b3381dd65c0b6a23b228a09973989ce5e249 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Sat, 14 Oct 2023 13:30:38 +1000 Subject: [PATCH 1/2] Update to .NET 8 RC2 --- Build.ps1 | 6 +++--- Setup.ps1 | 11 +++++++++++ appveyor.yml | 5 +++-- global.json | 5 +++++ samples/Sample/Sample.csproj | 6 +++--- serilog-extensions-logging.sln | 3 +++ .../Serilog.Extensions.Logging.csproj | 6 +++--- .../Serilog.Extensions.Logging.Benchmarks.csproj | 10 +++++----- .../Serilog.Extensions.Logging.Tests.csproj | 12 ++++++------ 9 files changed, 42 insertions(+), 22 deletions(-) create mode 100644 Setup.ps1 create mode 100644 global.json diff --git a/Build.ps1 b/Build.ps1 index a674b52..b20a19e 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -26,7 +26,7 @@ foreach ($src in ls src/*) { & dotnet pack -c Release --include-source -o ..\..\artifacts } - if($LASTEXITCODE -ne 0) { exit 1 } + if($LASTEXITCODE -ne 0) { throw "build failed" } Pop-Location } @@ -37,7 +37,7 @@ foreach ($test in ls test/*.PerformanceTests) { echo "build: Building performance test project in $test" & dotnet build -c Release - if($LASTEXITCODE -ne 0) { exit 2 } + if($LASTEXITCODE -ne 0) { throw "test failed" } Pop-Location } @@ -48,7 +48,7 @@ foreach ($test in ls test/*.Tests) { echo "build: Testing project in $test" & dotnet test -c Release - if($LASTEXITCODE -ne 0) { exit 3 } + if($LASTEXITCODE -ne 0) { throw "test failed" } Pop-Location } diff --git a/Setup.ps1 b/Setup.ps1 new file mode 100644 index 0000000..6812767 --- /dev/null +++ b/Setup.ps1 @@ -0,0 +1,11 @@ +$ErrorActionPreference = "Stop" + +$RequiredDotnetVersion = $(cat ./global.json | convertfrom-json).sdk.version + +New-Item -ItemType Directory -Force "./build/" | Out-Null + +Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./build/installcli.ps1" +& ./build/installcli.ps1 -InstallDir "$pwd/.dotnetcli" -NoPath -Version $RequiredDotnetVersion +if ($LASTEXITCODE) { throw ".NET install failed" } + +$env:Path = "$pwd/.dotnetcli;$env:Path" diff --git a/appveyor.yml b/appveyor.yml index 3e4a484..ae5bee4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,9 +2,10 @@ version: '{build}' skip_tags: true image: Visual Studio 2022 install: - - ps: mkdir -Force ".\build\" | Out-Null +- pwsh: ./Setup.ps1 +- pwsh: mkdir -Force ".\build\" | Out-Null build_script: -- ps: ./Build.ps1 +- pwsh: ./Build.ps1 test: off artifacts: - path: artifacts/Serilog.*.nupkg diff --git a/global.json b/global.json new file mode 100644 index 0000000..3ecc5db --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "8.0.100-rc.2.23502.2" + } +} diff --git a/samples/Sample/Sample.csproj b/samples/Sample/Sample.csproj index ef89f43..16b9ecb 100644 --- a/samples/Sample/Sample.csproj +++ b/samples/Sample/Sample.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 Sample Exe enable @@ -12,8 +12,8 @@ - - + + diff --git a/serilog-extensions-logging.sln b/serilog-extensions-logging.sln index 9e91f73..776ae3c 100644 --- a/serilog-extensions-logging.sln +++ b/serilog-extensions-logging.sln @@ -24,6 +24,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "assets", "assets", "{9C21B9 Directory.Build.targets = Directory.Build.targets README.md = README.md assets\Serilog.snk = assets\Serilog.snk + build.sh = build.sh + Setup.ps1 = Setup.ps1 + global.json = global.json EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Serilog.Extensions.Logging.Benchmarks", "test\Serilog.Extensions.Logging.Benchmarks\Serilog.Extensions.Logging.Benchmarks.csproj", "{6D5986FF-EECD-4E75-8BC6-A5F78AB549B2}" diff --git a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj index 2b17b58..285ab7b 100644 --- a/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj +++ b/src/Serilog.Extensions.Logging/Serilog.Extensions.Logging.csproj @@ -3,11 +3,11 @@ Low-level Serilog provider for Microsoft.Extensions.Logging - 7.0.1 + 8.0.0 Microsoft;Serilog Contributors - net462;netstandard2.0;netstandard2.1;net6.0;net7.0 + net462;netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0 true serilog;Microsoft.Extensions.Logging serilog-extension-nuget.png @@ -31,7 +31,7 @@ - + diff --git a/test/Serilog.Extensions.Logging.Benchmarks/Serilog.Extensions.Logging.Benchmarks.csproj b/test/Serilog.Extensions.Logging.Benchmarks/Serilog.Extensions.Logging.Benchmarks.csproj index dcaf754..7d85956 100644 --- a/test/Serilog.Extensions.Logging.Benchmarks/Serilog.Extensions.Logging.Benchmarks.csproj +++ b/test/Serilog.Extensions.Logging.Benchmarks/Serilog.Extensions.Logging.Benchmarks.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable @@ -10,10 +10,10 @@ - - - - + + + + diff --git a/test/Serilog.Extensions.Logging.Tests/Serilog.Extensions.Logging.Tests.csproj b/test/Serilog.Extensions.Logging.Tests/Serilog.Extensions.Logging.Tests.csproj index d7df0d9..4dd1afb 100644 --- a/test/Serilog.Extensions.Logging.Tests/Serilog.Extensions.Logging.Tests.csproj +++ b/test/Serilog.Extensions.Logging.Tests/Serilog.Extensions.Logging.Tests.csproj @@ -1,11 +1,11 @@ - net7.0;net472 + net8.0;net48 enable - - + + $(DefineConstants);FORCE_W3C_ACTIVITY_ID @@ -14,9 +14,9 @@ - - - + + + From 80064f8670737b74db738fafb3d46a9843f130c2 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Mon, 16 Oct 2023 18:37:27 +1000 Subject: [PATCH 2/2] Set SDK path from build script --- Build.ps1 | 2 ++ Setup.ps1 | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Build.ps1 b/Build.ps1 index b20a19e..431f4e2 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -1,5 +1,7 @@ echo "build: Build started" +$env:Path = "$pwd/.dotnetcli;$env:Path" + Push-Location $PSScriptRoot if(Test-Path .\artifacts) { diff --git a/Setup.ps1 b/Setup.ps1 index 6812767..aa90b5b 100644 --- a/Setup.ps1 +++ b/Setup.ps1 @@ -7,5 +7,3 @@ New-Item -ItemType Directory -Force "./build/" | Out-Null Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile "./build/installcli.ps1" & ./build/installcli.ps1 -InstallDir "$pwd/.dotnetcli" -NoPath -Version $RequiredDotnetVersion if ($LASTEXITCODE) { throw ".NET install failed" } - -$env:Path = "$pwd/.dotnetcli;$env:Path"