Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix library versioning: reading version from assembly #196

Merged
merged 2 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions src/NRedisStack/Auxiliary.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Xml.Linq;
using NRedisStack.Core;
using NRedisStack.RedisStackCommands;
using StackExchange.Redis;
Expand Down Expand Up @@ -132,23 +131,8 @@ public async static Task<List<RedisResult>> 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;
Version version = typeof(Auxiliary).Assembly.GetName().Version!;
return $"{version.Major}.{version.Minor}.{version.Build}";
}
}
}
6 changes: 3 additions & 3 deletions src/NRedisStack/NRedisStack.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<Owners>Redis OSS</Owners>
<Description>.Net Client for Redis Stack</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>0.10.0</Version>
<ReleaseVersion>0.10.0</ReleaseVersion>
<PackageVersion>0.10.0</PackageVersion>
<Version>0.10.1</Version>
<ReleaseVersion>0.10.1</ReleaseVersion>
<PackageVersion>0.10.1</PackageVersion>
</PropertyGroup>

<ItemGroup>
Expand Down