From 8707912df7f6023fb9660c4bf3dd1588ea125238 Mon Sep 17 00:00:00 2001 From: Paul Welter Date: Wed, 9 Aug 2023 14:23:42 -0500 Subject: [PATCH] remove anything to do with SponsorLink --- .../Tracker/Tracker.Core/Tracker.Core.csproj | 2 +- .../Tracker.Scaffold/Tracker.Scaffold.csproj | 4 +- .../AssemblyMetadata.cs | 50 +++++++++++++++++++ .../EntityFrameworkCore.Generator.Core.csproj | 6 +-- .../EntityFrameworkCore.Generator.csproj | 4 -- src/EntityFrameworkCore.Generator/Program.cs | 3 +- ...yFrameworkCore.Generator.Core.Tests.csproj | 2 +- 7 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 src/EntityFrameworkCore.Generator.Core/AssemblyMetadata.cs diff --git a/sample/Tracker/Tracker.Core/Tracker.Core.csproj b/sample/Tracker/Tracker.Core/Tracker.Core.csproj index d919c9ec..e0465467 100644 --- a/sample/Tracker/Tracker.Core/Tracker.Core.csproj +++ b/sample/Tracker/Tracker.Core/Tracker.Core.csproj @@ -9,7 +9,7 @@ - + diff --git a/sample/Tracker/Tracker.Scaffold/Tracker.Scaffold.csproj b/sample/Tracker/Tracker.Scaffold/Tracker.Scaffold.csproj index 0616afc3..de3e71e0 100644 --- a/sample/Tracker/Tracker.Scaffold/Tracker.Scaffold.csproj +++ b/sample/Tracker/Tracker.Scaffold/Tracker.Scaffold.csproj @@ -8,11 +8,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/EntityFrameworkCore.Generator.Core/AssemblyMetadata.cs b/src/EntityFrameworkCore.Generator.Core/AssemblyMetadata.cs new file mode 100644 index 00000000..d0168e12 --- /dev/null +++ b/src/EntityFrameworkCore.Generator.Core/AssemblyMetadata.cs @@ -0,0 +1,50 @@ +using System.Reflection; + +namespace EntityFrameworkCore.Generator; + +public static class AssemblyMetadata +{ + private static readonly Lazy _fileVersion = new(() => + { + var assembly = typeof(AssemblyMetadata).Assembly; + var attribute = assembly.GetCustomAttribute(); + return attribute?.Version; + }); + + private static readonly Lazy _assemblyVersion = new(() => + { + var assembly = typeof(AssemblyMetadata).Assembly; + var attribute = assembly.GetCustomAttribute(); + return attribute?.Version; + }); + + private static readonly Lazy _informationVersion = new(() => + { + var assembly = typeof(AssemblyMetadata).Assembly; + var attribute = assembly.GetCustomAttribute(); + return attribute?.InformationalVersion; + }); + + private static readonly Lazy _assemblyDescription = new(() => + { + var assembly = typeof(AssemblyMetadata).Assembly; + var attribute = assembly.GetCustomAttribute(); + return attribute?.Description; + }); + + private static readonly Lazy _assemblyName = new(() => + { + var assembly = typeof(AssemblyMetadata).Assembly; + return assembly.GetName().Name; + }); + + public static string FileVersion => _fileVersion.Value; + + public static string AssemblyVersion => _assemblyVersion.Value; + + public static string AssemblyDescription => _assemblyDescription.Value; + + public static string AssemblyName => _assemblyName.Value; + + public static string InformationalVersion => _informationVersion.Value; +} diff --git a/src/EntityFrameworkCore.Generator.Core/EntityFrameworkCore.Generator.Core.csproj b/src/EntityFrameworkCore.Generator.Core/EntityFrameworkCore.Generator.Core.csproj index bd8fff4b..e8698225 100644 --- a/src/EntityFrameworkCore.Generator.Core/EntityFrameworkCore.Generator.Core.csproj +++ b/src/EntityFrameworkCore.Generator.Core/EntityFrameworkCore.Generator.Core.csproj @@ -7,11 +7,11 @@ - + - - + + diff --git a/src/EntityFrameworkCore.Generator/EntityFrameworkCore.Generator.csproj b/src/EntityFrameworkCore.Generator/EntityFrameworkCore.Generator.csproj index 929bd100..e29e53ab 100644 --- a/src/EntityFrameworkCore.Generator/EntityFrameworkCore.Generator.csproj +++ b/src/EntityFrameworkCore.Generator/EntityFrameworkCore.Generator.csproj @@ -11,10 +11,6 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/src/EntityFrameworkCore.Generator/Program.cs b/src/EntityFrameworkCore.Generator/Program.cs index 21b9011b..28dea8cc 100644 --- a/src/EntityFrameworkCore.Generator/Program.cs +++ b/src/EntityFrameworkCore.Generator/Program.cs @@ -2,6 +2,7 @@ using McMaster.Extensions.CommandLineUtils; +using Microsoft.CodeAnalysis; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -67,5 +68,5 @@ public static int Main(string[] args) } - private static string GetVersion() => ThisAssembly.Info.InformationalVersion; + private static string GetVersion() => AssemblyMetadata.InformationalVersion; } diff --git a/test/EntityFrameworkCore.Generator.Core.Tests/EntityFrameworkCore.Generator.Core.Tests.csproj b/test/EntityFrameworkCore.Generator.Core.Tests/EntityFrameworkCore.Generator.Core.Tests.csproj index 17976e64..ff5b53b9 100644 --- a/test/EntityFrameworkCore.Generator.Core.Tests/EntityFrameworkCore.Generator.Core.Tests.csproj +++ b/test/EntityFrameworkCore.Generator.Core.Tests/EntityFrameworkCore.Generator.Core.Tests.csproj @@ -26,7 +26,7 @@ - + all