From de0791a4ddfcab68fa23f9079edc6ac84acf0c26 Mon Sep 17 00:00:00 2001 From: Adam Ralph Date: Thu, 26 Dec 2024 20:40:25 +0000 Subject: [PATCH] switch from net6 to net9 and update SDKs --- .github/workflows/ci.yml | 39 ++++++++++++------- .github/workflows/infer-sharp.yml | 2 +- .github/workflows/release.yml | 2 +- MSBuild.Caching/MSBuild.Caching.csproj | 2 +- MinVer.Lib/MinVer.Lib.csproj | 2 +- MinVer/MinVer.csproj | 4 +- MinVer/build/MinVer.targets | 7 ++-- MinVerTests.Infra/MinVerCli.cs | 6 +-- MinVerTests.Infra/MinVerTests.Infra.csproj | 2 +- MinVerTests.Infra/Sdk.cs | 8 ++-- MinVerTests.Lib/MinVerTests.Lib.csproj | 4 +- .../MinVerTests.Packages.csproj | 4 +- global.json | 2 +- minver-cli/minver-cli.csproj | 2 +- targets/Targets.csproj | 2 +- 15 files changed, 54 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34fed438..afae55c1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,57 +18,70 @@ jobs: os: macos-13 tests: framework: net8.0 - sdk: "8.0.401" + sdk: "8.0.404" sdk-major-minor: "8.0" # current macOS, latest LTS and latest - job: os: macos-14 tests: framework: net8.0 - sdk: "8.0.401" + sdk: "8.0.404" sdk-major-minor: "8.0" + - job: + os: macos-14 + tests: + framework: net9.0 + sdk: "9.0.101" + sdk-major-minor: "9.0" # old Linux, latest LTS - job: os: ubuntu-20.04 tests: framework: net8.0 - sdk: "8.0.401" + sdk: "8.0.404" sdk-major-minor: "8.0" # old Linux, latest LTS - job: os: ubuntu-22.04 tests: framework: net8.0 - sdk: "8.0.401" + sdk: "8.0.404" sdk-major-minor: "8.0" # current Linux, all - job: os: ubuntu-24.04 + upload: true tests: - framework: net6.0 - sdk: "6.0.425" - sdk-major-minor: "6.0" + framework: net8.0 + sdk: "8.0.404" + sdk-major-minor: "8.0" - job: os: ubuntu-24.04 upload: true tests: - framework: net8.0 - sdk: "8.0.401" - sdk-major-minor: "8.0" + framework: net9.0 + sdk: "9.0.101" + sdk-major-minor: "9.0" # old Windows, latest LTS - job: os: windows-2019 tests: framework: net8.0 - sdk: "8.0.401" + sdk: "8.0.404" sdk-major-minor: "8.0" # current Windows, latest LTS and latest - job: os: windows-2022 tests: framework: net8.0 - sdk: "8.0.401" + sdk: "8.0.404" sdk-major-minor: "8.0" + - job: + os: windows-2022 + tests: + framework: net9.0 + sdk: "9.0.101" + sdk-major-minor: "9.0" name: ${{ matrix.job.os }}-sdk-${{ matrix.tests.sdk-major-minor }} runs-on: ${{ matrix.job.os }} steps: @@ -76,7 +89,7 @@ jobs: with: dotnet-version: | ${{ matrix.tests.sdk }} - 8.0.401 + 9.0.101 - run: dotnet --info - run: git --version - uses: actions/checkout@v4.1.7 diff --git a/.github/workflows/infer-sharp.yml b/.github/workflows/infer-sharp.yml index 46201d2d..3cc3a91e 100644 --- a/.github/workflows/infer-sharp.yml +++ b/.github/workflows/infer-sharp.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/setup-dotnet@v4.0.1 with: - dotnet-version: '8.0.401' + dotnet-version: '9.0.101' - uses: actions/checkout@v4.1.7 - run: dotnet build - run: ls -al diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75117303..613b1906 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/setup-dotnet@v4.0.1 with: - dotnet-version: 8.0.401 + dotnet-version: 9.0.101 - uses: actions/checkout@v4.1.7 - env: MINVER_VERSION: ${{ vars.MINVER_VERSION }} diff --git a/MSBuild.Caching/MSBuild.Caching.csproj b/MSBuild.Caching/MSBuild.Caching.csproj index df1c0246..6ac54245 100644 --- a/MSBuild.Caching/MSBuild.Caching.csproj +++ b/MSBuild.Caching/MSBuild.Caching.csproj @@ -2,7 +2,7 @@ false - net472;net6.0 + net472;net8.0 12.0 diff --git a/MinVer.Lib/MinVer.Lib.csproj b/MinVer.Lib/MinVer.Lib.csproj index 0095d5e7..6a4fc626 100644 --- a/MinVer.Lib/MinVer.Lib.csproj +++ b/MinVer.Lib/MinVer.Lib.csproj @@ -2,7 +2,7 @@ false - net6.0;net8.0 + net8.0;net9.0 diff --git a/MinVer/MinVer.csproj b/MinVer/MinVer.csproj index f29e4649..c7403776 100644 --- a/MinVer/MinVer.csproj +++ b/MinVer/MinVer.csproj @@ -18,7 +18,7 @@ true major true - net6.0;net8.0 + net8.0;net9.0 @@ -43,7 +43,7 @@ - + diff --git a/MinVer/build/MinVer.targets b/MinVer/build/MinVer.targets index 747d9974..77465989 100644 --- a/MinVer/build/MinVer.targets +++ b/MinVer/build/MinVer.targets @@ -4,7 +4,7 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) $(GenerateNuspecDependsOn);MinVer $(GetPackageVersionDependsOn);MinVer - $(MSBuildThisFileDirectory)bin\net6.0\MSBuild.Caching.dll + $(MSBuildThisFileDirectory)bin\net8.0\MSBuild.Caching.dll $(MSBuildThisFileDirectory)bin\net472\MSBuild.Caching.dll @@ -14,8 +14,9 @@ low high - net6.0 - net8.0 + net8.0 + + net9.0 $(NoWarn);NU5105 diff --git a/MinVerTests.Infra/MinVerCli.cs b/MinVerTests.Infra/MinVerCli.cs index e3eccf27..ac72a1fd 100644 --- a/MinVerTests.Infra/MinVerCli.cs +++ b/MinVerTests.Infra/MinVerCli.cs @@ -11,10 +11,10 @@ public static class MinVerCli } public static string GetPath(string configuration) => -#if NET6_0 - Solution.GetFullPath($"minver-cli/bin/{configuration}/net6.0/minver-cli.dll"); -#endif #if NET8_0 Solution.GetFullPath($"minver-cli/bin/{configuration}/net8.0/minver-cli.dll"); #endif +#if NET9_0 + Solution.GetFullPath($"minver-cli/bin/{configuration}/net9.0/minver-cli.dll"); +#endif } diff --git a/MinVerTests.Infra/MinVerTests.Infra.csproj b/MinVerTests.Infra/MinVerTests.Infra.csproj index d565deb3..7b6cfd46 100644 --- a/MinVerTests.Infra/MinVerTests.Infra.csproj +++ b/MinVerTests.Infra/MinVerTests.Infra.csproj @@ -2,7 +2,7 @@ false - net6.0;net8.0 + net8.0;net9.0 diff --git a/MinVerTests.Infra/Sdk.cs b/MinVerTests.Infra/Sdk.cs index 5c2a9a62..1098099a 100644 --- a/MinVerTests.Infra/Sdk.cs +++ b/MinVerTests.Infra/Sdk.cs @@ -199,10 +199,12 @@ private static (Version Version, string InformationalVersion) GetAssemblyVersion try { - return ( - assembly.GetName().Version ?? throw new InvalidOperationException("The assembly version is null."), + var version = assembly.GetName().Version ?? throw new InvalidOperationException("The assembly version is null."); + var informationalVersion = assembly.GetCustomAttributes().OfType().FirstOrDefault()?.InformationalVersion ?? - throw new InvalidOperationException("The assembly has no informational version.")); + throw new InvalidOperationException("The assembly has no informational version."); + + return (version, informationalVersion); } finally { diff --git a/MinVerTests.Lib/MinVerTests.Lib.csproj b/MinVerTests.Lib/MinVerTests.Lib.csproj index 8b1d85ef..ca09411a 100644 --- a/MinVerTests.Lib/MinVerTests.Lib.csproj +++ b/MinVerTests.Lib/MinVerTests.Lib.csproj @@ -1,8 +1,10 @@ + + $(NoWarn);CA1515 major - net6.0;net8.0 + net8.0;net9.0 diff --git a/MinVerTests.Packages/MinVerTests.Packages.csproj b/MinVerTests.Packages/MinVerTests.Packages.csproj index 023259b5..5cec53a0 100644 --- a/MinVerTests.Packages/MinVerTests.Packages.csproj +++ b/MinVerTests.Packages/MinVerTests.Packages.csproj @@ -1,8 +1,10 @@ + + $(NoWarn);CA1515 major - net8.0 + net9.0 diff --git a/global.json b/global.json index fb5108f3..aad16d85 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100", + "version": "9.0.100", "rollForward": "latestMajor" } } diff --git a/minver-cli/minver-cli.csproj b/minver-cli/minver-cli.csproj index ea2acb5e..07fa65f2 100644 --- a/minver-cli/minver-cli.csproj +++ b/minver-cli/minver-cli.csproj @@ -14,7 +14,7 @@ true major MinVer - net6.0;net8.0 + net8.0;net9.0 minver diff --git a/targets/Targets.csproj b/targets/Targets.csproj index 4a261336..98f4e348 100644 --- a/targets/Targets.csproj +++ b/targets/Targets.csproj @@ -4,7 +4,7 @@ false Exe major - net8.0 + net9.0