From cc296b1904d27c781e0eff90282289fe7e9cded7 Mon Sep 17 00:00:00 2001 From: slorello89 Date: Thu, 19 Oct 2023 13:24:08 -0400 Subject: [PATCH 1/2] reading version from assembly rather than from csproj --- src/NRedisStack/Auxiliary.cs | 19 +------------------ src/NRedisStack/NRedisStack.csproj | 6 +++--- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/NRedisStack/Auxiliary.cs b/src/NRedisStack/Auxiliary.cs index 207f39ac..a730f9c3 100644 --- a/src/NRedisStack/Auxiliary.cs +++ b/src/NRedisStack/Auxiliary.cs @@ -1,4 +1,3 @@ -using System.Xml.Linq; using NRedisStack.Core; using NRedisStack.RedisStackCommands; using StackExchange.Redis; @@ -132,23 +131,7 @@ public async static Task> ExecuteBroadcastAsync(this IDatabase public static string GetNRedisStackVersion() { - XDocument csprojDocument = GetCsprojDocument(); - - // Find the Version element and get its value. - var versionElement = csprojDocument.Root! - .Descendants("Version") - .FirstOrDefault(); - - return versionElement!.Value; - } - - private static XDocument GetCsprojDocument() - { - string csprojFilePath = Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "..", "src", "NRedisStack", "NRedisStack.csproj"); - - // Load the .csproj file. - var csprojDocument = XDocument.Load(csprojFilePath); - return csprojDocument; + return typeof(NRedisStack.Auxiliary).Assembly.GetName().Version.ToString(); } } } \ No newline at end of file diff --git a/src/NRedisStack/NRedisStack.csproj b/src/NRedisStack/NRedisStack.csproj index 56278688..3441d99c 100644 --- a/src/NRedisStack/NRedisStack.csproj +++ b/src/NRedisStack/NRedisStack.csproj @@ -9,9 +9,9 @@ Redis OSS .Net Client for Redis Stack README.md - 0.10.0 - 0.10.0 - 0.10.0 + 0.10.1 + 0.10.1 + 0.10.1 From b99a6e793b74f665fda66415db9ae8a68c816190 Mon Sep 17 00:00:00 2001 From: shacharPash Date: Sun, 22 Oct 2023 13:09:05 +0300 Subject: [PATCH 2/2] x.y.z format & ignore null warning --- src/NRedisStack/Auxiliary.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/NRedisStack/Auxiliary.cs b/src/NRedisStack/Auxiliary.cs index a730f9c3..d5555fb7 100644 --- a/src/NRedisStack/Auxiliary.cs +++ b/src/NRedisStack/Auxiliary.cs @@ -131,7 +131,8 @@ public async static Task> ExecuteBroadcastAsync(this IDatabase public static string GetNRedisStackVersion() { - return typeof(NRedisStack.Auxiliary).Assembly.GetName().Version.ToString(); + Version version = typeof(Auxiliary).Assembly.GetName().Version!; + return $"{version.Major}.{version.Minor}.{version.Build}"; } } } \ No newline at end of file