From d7f945ab826adc6acfd3aacfacd34e8242606872 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Thu, 6 Aug 2020 20:04:17 +0100 Subject: [PATCH] Fix Dll SearchPath to include Assembly Directory. Commit 28b46390 added the ability to load the 32bit dll from the current directory. However on MacOS/dotnet this does not work. The current `DllImportSearchPath` setting only allows for loading from known `Safe` paths. On MacOS/dotnet it seems this does not include the assembly directoy. Our current setup in Xamarin.Android places the native libaries in the same directory as the assembly, so we need that to work. The fix is to include the value `AssemblyDirectory` in the `DllImportSearchPath` setting as well as the `SafeDirectories` value. This should allow `dotnet` to find native libraries which are in the same directory. --- LibZipSharp.props | 2 +- Native.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LibZipSharp.props b/LibZipSharp.props index 8abf71e0..5e6deacd 100644 --- a/LibZipSharp.props +++ b/LibZipSharp.props @@ -1,5 +1,5 @@ - <_LibZipSharpNugetVersion>1.0.18 + <_LibZipSharpNugetVersion>1.0.19 diff --git a/Native.cs b/Native.cs index ada88853..6876beab 100644 --- a/Native.cs +++ b/Native.cs @@ -27,7 +27,7 @@ using System; using System.Runtime.InteropServices; -[assembly: DefaultDllImportSearchPathsAttribute(DllImportSearchPath.SafeDirectories)] +[assembly: DefaultDllImportSearchPathsAttribute(DllImportSearchPath.SafeDirectories | DllImportSearchPath.AssemblyDirectory)] namespace Xamarin.Tools.Zip {