From 4541ebc002dc0f4b22d51de3cfb0429f87267ac9 Mon Sep 17 00:00:00 2001 From: JusterZhu Date: Thu, 21 May 2026 17:59:42 +0800 Subject: [PATCH] fix: find bundled test_app_exe from exe directory, not BaseDirectory AppDomain.CurrentDomain.BaseDirectory points to the extraction temp dir when running as a single-file publish. Use Environment.ProcessPath to locate the actual exe directory where test_app_exe/ lives. --- src/Services/SimulationService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Services/SimulationService.cs b/src/Services/SimulationService.cs index 3d427e0..5d33f25 100644 --- a/src/Services/SimulationService.cs +++ b/src/Services/SimulationService.cs @@ -47,7 +47,9 @@ public async Task RunAsync( else { // Strategy 1: bundled exes (release package) - var bundledDir = Path.Combine(toolsDir, "test_app_exe"); + // Use ProcessPath not BaseDirectory — single-file publish extracts to a temp dir + var appRoot = Path.GetDirectoryName(Environment.ProcessPath)!; + var bundledDir = Path.Combine(appRoot, "test_app_exe"); if (Directory.Exists(bundledDir) && File.Exists(Path.Combine(bundledDir, "ClientSample.exe")) && File.Exists(Path.Combine(bundledDir, "UpgradeSample.exe")))