From 4834a64773840024f3736638bf75b24271fc5dbb Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Sat, 3 Oct 2020 16:35:54 -0300 Subject: [PATCH] Add prerequisite checks to avoid confusing users Explicit build targets now check for the two requirements for ThisAssembly: MSBuild 16.8+ or .NET SDK 5.0+ and C#. --- ThisAssembly.sln | 6 +++++ .../ThisAssembly.AssemblyInfo.csproj | 1 + .../ThisAssembly.Metadata.csproj | 1 + .../ThisAssembly.Prerequisites.csproj | 26 +++++++++++++++++++ .../ThisAssembly.Prerequisites.props | 7 +++++ .../ThisAssembly.Prerequisites.targets | 10 +++++++ .../ThisAssembly.Project.csproj | 1 + .../ThisAssembly.Strings.csproj | 3 ++- 8 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/ThisAssembly.Prerequisites/ThisAssembly.Prerequisites.csproj create mode 100644 src/ThisAssembly.Prerequisites/ThisAssembly.Prerequisites.props create mode 100644 src/ThisAssembly.Prerequisites/ThisAssembly.Prerequisites.targets diff --git a/ThisAssembly.sln b/ThisAssembly.sln index 38d7eeb4..d1b34b85 100644 --- a/ThisAssembly.sln +++ b/ThisAssembly.sln @@ -29,6 +29,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ .github\workflows\release.yml = .github\workflows\release.yml EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ThisAssembly.Prerequisites", "src\ThisAssembly.Prerequisites\ThisAssembly.Prerequisites.csproj", "{568E5150-84AD-4619-BEA3-AA5EDF084ABC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -59,6 +61,10 @@ Global {3E7158B5-BFEF-4416-8226-9096C7C98268}.Debug|Any CPU.Build.0 = Debug|Any CPU {3E7158B5-BFEF-4416-8226-9096C7C98268}.Release|Any CPU.ActiveCfg = Release|Any CPU {3E7158B5-BFEF-4416-8226-9096C7C98268}.Release|Any CPU.Build.0 = Release|Any CPU + {568E5150-84AD-4619-BEA3-AA5EDF084ABC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {568E5150-84AD-4619-BEA3-AA5EDF084ABC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {568E5150-84AD-4619-BEA3-AA5EDF084ABC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {568E5150-84AD-4619-BEA3-AA5EDF084ABC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/ThisAssembly.AssemblyInfo/ThisAssembly.AssemblyInfo.csproj b/src/ThisAssembly.AssemblyInfo/ThisAssembly.AssemblyInfo.csproj index d80c6d14..31507279 100644 --- a/src/ThisAssembly.AssemblyInfo/ThisAssembly.AssemblyInfo.csproj +++ b/src/ThisAssembly.AssemblyInfo/ThisAssembly.AssemblyInfo.csproj @@ -33,6 +33,7 @@ on the `ThisAssembly.Info` class. + diff --git a/src/ThisAssembly.Metadata/ThisAssembly.Metadata.csproj b/src/ThisAssembly.Metadata/ThisAssembly.Metadata.csproj index c3a923c6..1cc9eef7 100644 --- a/src/ThisAssembly.Metadata/ThisAssembly.Metadata.csproj +++ b/src/ThisAssembly.Metadata/ThisAssembly.Metadata.csproj @@ -64,6 +64,7 @@ F#: + diff --git a/src/ThisAssembly.Prerequisites/ThisAssembly.Prerequisites.csproj b/src/ThisAssembly.Prerequisites/ThisAssembly.Prerequisites.csproj new file mode 100644 index 00000000..8fb2cc5a --- /dev/null +++ b/src/ThisAssembly.Prerequisites/ThisAssembly.Prerequisites.csproj @@ -0,0 +1,26 @@ + + + + netstandard2.0 + false + + + + ThisAssembly.Prerequisites + Ensures that referencing project satisfies the prerequisites for ThisAssembly, namely: + +* MSBuild 16.8+: contains the Roslyn support for source generators +* C# language: it's the only language supported by Roslyn source generators at the moment. + + + + + + + + + + + + + diff --git a/src/ThisAssembly.Prerequisites/ThisAssembly.Prerequisites.props b/src/ThisAssembly.Prerequisites/ThisAssembly.Prerequisites.props new file mode 100644 index 00000000..9ccf5ec6 --- /dev/null +++ b/src/ThisAssembly.Prerequisites/ThisAssembly.Prerequisites.props @@ -0,0 +1,7 @@ + + + + Preview + + + \ No newline at end of file diff --git a/src/ThisAssembly.Prerequisites/ThisAssembly.Prerequisites.targets b/src/ThisAssembly.Prerequisites/ThisAssembly.Prerequisites.targets new file mode 100644 index 00000000..112b5478 --- /dev/null +++ b/src/ThisAssembly.Prerequisites/ThisAssembly.Prerequisites.targets @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/src/ThisAssembly.Project/ThisAssembly.Project.csproj b/src/ThisAssembly.Project/ThisAssembly.Project.csproj index 1f347a11..b438bc72 100644 --- a/src/ThisAssembly.Project/ThisAssembly.Project.csproj +++ b/src/ThisAssembly.Project/ThisAssembly.Project.csproj @@ -66,6 +66,7 @@ F#: + diff --git a/src/ThisAssembly.Strings/ThisAssembly.Strings.csproj b/src/ThisAssembly.Strings/ThisAssembly.Strings.csproj index 45342984..f2438f0f 100644 --- a/src/ThisAssembly.Strings/ThisAssembly.Strings.csproj +++ b/src/ThisAssembly.Strings/ThisAssembly.Strings.csproj @@ -25,11 +25,12 @@ such as "Hello {name}". - + +