From 61792b8a3f8513008e0d16e97b8222736e167138 Mon Sep 17 00:00:00 2001 From: Tamara Rivera Date: Thu, 26 Feb 2026 09:46:54 -0800 Subject: [PATCH] Make RavenDB roll forward to the next available higher major version --- src/Particular.PlatformSample/AppLauncher.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Particular.PlatformSample/AppLauncher.cs b/src/Particular.PlatformSample/AppLauncher.cs index 86790ea..4720180 100644 --- a/src/Particular.PlatformSample/AppLauncher.cs +++ b/src/Particular.PlatformSample/AppLauncher.cs @@ -16,7 +16,7 @@ sealed class AppLauncher(bool showPlatformToolConsoleOutput) : IAsyncDisposable readonly bool hideConsoleOutput = !showPlatformToolConsoleOutput; readonly Stack> cleanupActions = new(); - public Task RavenDB(string logsPath, string dataDirectory, CancellationToken cancellationToken = default) + public async Task RavenDB(string logsPath, string dataDirectory, CancellationToken cancellationToken = default) { var licenseFilePath = Path.Combine(platformPath, "servicecontrol", "servicecontrol-instance", "Persisters", "RavenDB", "RavenLicense.json"); @@ -24,13 +24,23 @@ public Task RavenDB(string logsPath, string dataDirectory, CancellationToke { LogsPath = logsPath, DataDirectory = dataDirectory, - CommandLineArgs = [$"--License.Path=\"{licenseFilePath}\""] + CommandLineArgs = [$"--License.Path=\"{licenseFilePath}\""], + FrameworkVersion = null }; + var currentRollforward = Environment.GetEnvironmentVariable("DOTNET_ROLL_FORWARD"); + + // Make RavenDB roll forward to the next available higher major version if the one it was built against is not installed + Environment.SetEnvironmentVariable("DOTNET_ROLL_FORWARD", "Major"); + EmbeddedServer.Instance.StartServer(options); cleanupActions.Push(() => StopRavenDB(cancellationToken)); - return EmbeddedServer.Instance.GetServerUriAsync(cancellationToken); + var result = await EmbeddedServer.Instance.GetServerUriAsync(cancellationToken).ConfigureAwait(false); + + Environment.SetEnvironmentVariable("DOTNET_ROLL_FORWARD", currentRollforward); + + return result; } static async ValueTask StopRavenDB(CancellationToken cancellationToken)