Skip to content

Commit 63420f2

Browse files
committed
Hotfix (relative to assembly rather than workdir)
1 parent a631a58 commit 63420f2

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

NotificationIcon.NET.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<Nullable>enable</Nullable>
88
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
99
<Configurations>Debug-Portable;Release-Windows;Release-Linux;Release-Portable</Configurations>
10-
<Version>1.2.0</Version>
10+
<Version>1.2.1</Version>
1111
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
1212
<Authors>Bip901</Authors>
1313
<Copyright>Ori Almagor</Copyright>

NotifyIcon.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,13 @@ protected NotifyIcon(string nativeLibraryName, string iconPath, IReadOnlyList<Me
121121
{
122122
if (!loadedNativeLibrary)
123123
{
124-
//Attempt loading from '.' first (if the hosting project was compiled with a RID)
125-
if (!NativeLibrary.TryLoad(nativeLibraryName, out _))
124+
//Attempt loading from the base directory ('.') first (if the hosting project was compiled with a RID)
125+
string baseDirectory = AppContext.BaseDirectory;
126+
if (!NativeLibrary.TryLoad(Path.Join(baseDirectory, nativeLibraryName), out _))
126127
{
127128
//Fallback to runtimes/{RID}/native (if the hosting project is portable)
128129
string rid = GetNonVersionSpecificRID();
129-
string path = string.Join(Path.DirectorySeparatorChar, "runtimes", rid, "native", nativeLibraryName);
130+
string path = Path.Join(baseDirectory, "runtimes", rid, "native", nativeLibraryName);
130131
try
131132
{
132133
NativeLibrary.Load(path);

0 commit comments

Comments
 (0)