Skip to content

Commit 50fb74a

Browse files
Fix library versioning: reading version from assembly (#196)
* reading version from assembly rather than from csproj * x.y.z format & ignore null warning --------- Co-authored-by: shacharPash <shachar.pashchur@redis.com>
1 parent 01e823c commit 50fb74a

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

src/NRedisStack/Auxiliary.cs

+2-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Xml.Linq;
21
using NRedisStack.Core;
32
using NRedisStack.RedisStackCommands;
43
using StackExchange.Redis;
@@ -132,23 +131,8 @@ public async static Task<List<RedisResult>> ExecuteBroadcastAsync(this IDatabase
132131

133132
public static string GetNRedisStackVersion()
134133
{
135-
XDocument csprojDocument = GetCsprojDocument();
136-
137-
// Find the Version element and get its value.
138-
var versionElement = csprojDocument.Root!
139-
.Descendants("Version")
140-
.FirstOrDefault();
141-
142-
return versionElement!.Value;
143-
}
144-
145-
private static XDocument GetCsprojDocument()
146-
{
147-
string csprojFilePath = Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "..", "src", "NRedisStack", "NRedisStack.csproj");
148-
149-
// Load the .csproj file.
150-
var csprojDocument = XDocument.Load(csprojFilePath);
151-
return csprojDocument;
134+
Version version = typeof(Auxiliary).Assembly.GetName().Version!;
135+
return $"{version.Major}.{version.Minor}.{version.Build}";
152136
}
153137
}
154138
}

src/NRedisStack/NRedisStack.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<Owners>Redis OSS</Owners>
1010
<Description>.Net Client for Redis Stack</Description>
1111
<PackageReadmeFile>README.md</PackageReadmeFile>
12-
<Version>0.10.0</Version>
13-
<ReleaseVersion>0.10.0</ReleaseVersion>
14-
<PackageVersion>0.10.0</PackageVersion>
12+
<Version>0.10.1</Version>
13+
<ReleaseVersion>0.10.1</ReleaseVersion>
14+
<PackageVersion>0.10.1</PackageVersion>
1515
</PropertyGroup>
1616

1717
<ItemGroup>

0 commit comments

Comments
 (0)