diff --git a/PowerSync/PowerSync.Common/Utils/PowerSyncPathResolver.cs b/PowerSync/PowerSync.Common/Utils/PowerSyncPathResolver.cs index be382d8..dd56d69 100644 --- a/PowerSync/PowerSync.Common/Utils/PowerSyncPathResolver.cs +++ b/PowerSync/PowerSync.Common/Utils/PowerSyncPathResolver.cs @@ -13,11 +13,18 @@ public static string GetNativeLibraryPath(string packagePath) return Path.Combine(AppContext.BaseDirectory, "powersync.dll"); } + string fileName = GetFileNameForPlatform(); + + // Packaged MSIX/Appx applications flatten all DLLs into one folder + string flattenedPath = Path.Combine(packagePath, fileName); + if (File.Exists(flattenedPath)) + { + return flattenedPath; + } + string rid = GetRuntimeIdentifier(); string nativeDir = Path.Combine(packagePath, "runtimes", rid, "native"); - string fileName = GetFileNameForPlatform(); - return Path.Combine(nativeDir, fileName); } @@ -63,4 +70,4 @@ private static string GetFileNameForPlatform() throw new PlatformNotSupportedException("Unsupported platform."); } } -} \ No newline at end of file +}