Skip to content

Commit 2b1762f

Browse files
authored
Fix Dll SearchPath to include Assembly Directory. (#69)
Commit 28b4639 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.
1 parent 28b4639 commit 2b1762f

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎LibZipSharp.props‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<ProjectDefaultTargets="Build"ToolsVersion="4.0"xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22
<PropertyGroup>
3-
<_LibZipSharpNugetVersion>1.0.18</_LibZipSharpNugetVersion>
3+
<_LibZipSharpNugetVersion>1.0.19</_LibZipSharpNugetVersion>
44
</PropertyGroup>
55
</Project>

‎Native.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
usingSystem;
2828
usingSystem.Runtime.InteropServices;
2929

30-
[assembly:DefaultDllImportSearchPathsAttribute(DllImportSearchPath.SafeDirectories)]
30+
[assembly:DefaultDllImportSearchPathsAttribute(DllImportSearchPath.SafeDirectories|DllImportSearchPath.AssemblyDirectory)]
3131

3232
namespaceXamarin.Tools.Zip
3333
{

0 commit comments

Comments
 (0)