diff --git a/src/Squirrel/UpdateManager.cs b/src/Squirrel/UpdateManager.cs index 9f96e773e..e9d22b37f 100644 --- a/src/Squirrel/UpdateManager.cs +++ b/src/Squirrel/UpdateManager.cs @@ -187,7 +187,14 @@ public static void RestartApp(string exeToStart = null, string arguments = null) // launching a different version than we started with (this is why // we take the app's *name* rather than a full path) - exeToStart = exeToStart ?? Path.GetFileName(Assembly.GetEntryAssembly().Location); + if (exeToStart == null) + { + var exeFileFullPath = Process.GetCurrentProcess().MainModule.FileName; + // Get everything after the last backslash. + var fileNameRegex = new Regex(@"^.*\\(?[^\\]+\.exe)$"); + exeToStart = fileNameRegex.Match(exeFileFullPath).Groups["FileName"].Value; + } + var argsArg = arguments != null ? String.Format("-a \"{0}\"", arguments) : "";