Skip to content

Commit ea8e0bb

Browse files
committed
Make check work without NuGet.Versioning
1 parent 5dfe172 commit ea8e0bb

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/ServiceControl.RavenDB/ServiceControl.RavenDB.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<PackageReference Include="ByteSize" />
1010
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" />
1111
<PackageReference Include="NServiceBus" />
12-
<PackageReference Include="NuGet.Versioning" />
1312
<PackageReference Include="RavenDB.Embedded" />
1413
</ItemGroup>
1514

src/ServiceControl.RavenDB/StartupChecks.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
{
33
using System.Reflection;
44
using System.Threading;
5-
using NuGet.Versioning;
65
using Raven.Client.Documents;
76
using Raven.Client.ServerWide.Operations;
87

@@ -11,17 +10,16 @@ public static class StartupChecks
1110
public static async Task EnsureServerVersion(IDocumentStore store, CancellationToken cancellationToken = default)
1211
{
1312
var build = await store.Maintenance.Server.SendAsync(new GetBuildNumberOperation(), cancellationToken);
13+
var serverProductVersion = new Version(build.ProductVersion);
1414

15-
var clientVersion = SemanticVersion.Parse(typeof(Raven.Client.Constants).Assembly.GetCustomAttributes<AssemblyInformationalVersionAttribute>().First().InformationalVersion);
16-
var serverVersion = NuGetVersion.Parse(build.ProductVersion);
15+
var clientVersion = typeof(Raven.Client.Constants).Assembly.GetCustomAttributes<AssemblyInformationalVersionAttribute>().First().InformationalVersion;
16+
var parts = clientVersion.Split('.');
17+
var clientProductVersion = new Version($"{parts[0]}.{parts[1]}");
1718

18-
var serverHasLowerMajorMinor = serverVersion.Major < clientVersion.Major
19-
|| (serverVersion.Major == clientVersion.Major && serverVersion.Minor < clientVersion.Minor);
20-
21-
if (serverHasLowerMajorMinor)
19+
if (clientProductVersion > serverProductVersion)
2220
{
23-
throw new Exception($"ServiceControl expects at minimum RavenDB Server version {clientVersion.Major}.{clientVersion.Minor} but the server is using {build.ProductVersion}.");
21+
throw new Exception($"ServiceControl expects RavenDB Server version {clientProductVersion} or higher, but the server is using {serverProductVersion}.");
2422
}
2523
}
2624
}
27-
}
25+
}

0 commit comments

Comments
 (0)