Skip to content

Commit

Permalink
fix: Fixed assembly.Location issue for single file exe.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Jul 10, 2024
1 parent c1ed754 commit f7dc5cb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/libs/H.NotifyIcon/Core/TrayIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,15 @@ public static string GetProcessPath()
Assembly.GetEntryAssembly() ??
throw new InvalidOperationException("Entry assembly is not found.");

return assembly.Location;
#pragma warning disable IL3000
var location = assembly.Location;
#pragma warning restore IL3000
if (string.IsNullOrWhiteSpace(location))
{
location = AppContext.BaseDirectory;
}

return location;
}

/// <summary>
Expand Down

0 comments on commit f7dc5cb

Please sign in to comment.