From 20e74d759de6dd46907be848ac1f856664cd8c77 Mon Sep 17 00:00:00 2001 From: Ashleigh Adams Date: Thu, 12 Aug 2021 19:21:41 +0100 Subject: [PATCH] Allow overriding Verlite.CLI's target framework. This makes it easier for third parties to package Verlite.CLI by using `/p:TargetFramework=...` or `-f ...`. The change to Veritelite.Core.csproj was to fix this this error being raised otherwise: ``` Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(246,5): error NETSDK1005: Assets file '...\src\Verlite.CLI\obj\project.assets.json' doesn't have a target for 'net5.0'. Ensure that restore has run and that you have included 'net5.0' in the TargetFrameworks for your project. [C:\Git\VerliteMaster\src\Verlite.CLI\Verlite.CLI.csproj] ``` --- src/Verlite.CLI/Verlite.CLI.csproj | 3 +- src/Verlite.Core/Verlite.Core.csproj | 2 +- tests/IntegrationTests/run.sh | 2 ++ .../tests/publish-different-framework.sh | 28 +++++++++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 tests/IntegrationTests/tests/publish-different-framework.sh diff --git a/src/Verlite.CLI/Verlite.CLI.csproj b/src/Verlite.CLI/Verlite.CLI.csproj index 658d141..c4982fc 100644 --- a/src/Verlite.CLI/Verlite.CLI.csproj +++ b/src/Verlite.CLI/Verlite.CLI.csproj @@ -1,6 +1,7 @@ - + netcoreapp2.1 + netcoreapp2.1;net5.0; Exe true verlite diff --git a/src/Verlite.Core/Verlite.Core.csproj b/src/Verlite.Core/Verlite.Core.csproj index 5bdc5aa..35b2060 100644 --- a/src/Verlite.Core/Verlite.Core.csproj +++ b/src/Verlite.Core/Verlite.Core.csproj @@ -1,6 +1,6 @@ - netstandard2.0 + netstandard2.0 Core primitives and logic for automatic versioning via Git tags. Verlite diff --git a/tests/IntegrationTests/run.sh b/tests/IntegrationTests/run.sh index 48e00fe..937624b 100644 --- a/tests/IntegrationTests/run.sh +++ b/tests/IntegrationTests/run.sh @@ -4,6 +4,7 @@ set -euo pipefail cd "$(dirname $0)" export VERBOSE="" +export REPO_PATH="$(git rev-parse --show-toplevel)" # setup the packages as version 0.0.0 export NUGET_PACKAGES="$(mktemp -d)" @@ -59,5 +60,6 @@ test branch-follows-first-parent test msbuild test multiple-tags-on-same-commit test auto-fetch +test publish-different-framework echo "All complete." \ No newline at end of file diff --git a/tests/IntegrationTests/tests/publish-different-framework.sh b/tests/IntegrationTests/tests/publish-different-framework.sh new file mode 100644 index 0000000..b1449e9 --- /dev/null +++ b/tests/IntegrationTests/tests/publish-different-framework.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -euo pipefail + +git clone "$REPO_PATH" verlite > /dev/null 2> /dev/null + +dotnet publish \ + verlite/src/Verlite.CLI/Verlite.CLI.csproj \ + -o artifacts \ + -p:TargetFramework=net5.0 \ + -p:PackAsTool=false \ +> /dev/null 2> /dev/null + +dotnet publish \ + verlite/src/Verlite.CLI/Verlite.CLI.csproj \ + -o artifacts2 \ + -f=net5.0 \ + -p:PackAsTool=false \ +> /dev/null 2> /dev/null + +should-exist() { + if [[ ! -f "$1" ]]; then + echo "Missing artifact: $1" + exit 1 + fi +} + +should-exist artifacts/Verlite.CLI.dll +should-exist artifacts2/Verlite.CLI.dll \ No newline at end of file