@@ -61,9 +61,6 @@ static NativeMethods()
61
61
InitializeNativeLibrary ( ) ;
62
62
}
63
63
64
- private delegate bool TryLoadLibraryByNameDelegate ( string libraryName , Assembly assembly , DllImportSearchPath ? searchPath , out IntPtr handle ) ;
65
- private delegate bool TryLoadLibraryByPathDelegate ( string libraryPath , out IntPtr handle ) ;
66
-
67
64
private static string GetGlobalSettingsNativeLibraryPath ( )
68
65
{
69
66
string nativeLibraryDir = GlobalSettings . GetAndLockNativeLibraryPath ( ) ;
@@ -74,6 +71,9 @@ private static string GetGlobalSettingsNativeLibraryPath()
74
71
return Path . Combine ( nativeLibraryDir , libgit2 + Platform . GetNativeLibraryExtension ( ) ) ;
75
72
}
76
73
74
+ private delegate bool TryLoadLibraryByNameDelegate ( string libraryName , Assembly assembly , DllImportSearchPath ? searchPath , out IntPtr handle ) ;
75
+ private delegate bool TryLoadLibraryByPathDelegate ( string libraryPath , out IntPtr handle ) ;
76
+
77
77
static TryLoadLibraryByNameDelegate _tryLoadLibraryByName ;
78
78
static TryLoadLibraryByPathDelegate _tryLoadLibraryByPath ;
79
79
@@ -146,13 +146,14 @@ private static IntPtr ResolveDll(string libraryName, Assembly assembly, DllImpor
146
146
return handle ;
147
147
}
148
148
149
+ #if NETFRAMEWORK
150
+ #else
149
151
// We cary a number of .so files for Linux which are linked against various
150
152
// libc/OpenSSL libraries. Try them out.
151
153
if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) )
152
154
{
153
155
// The libraries are located at 'runtimes/<rid>/native/lib{libraryName}.so'
154
156
// The <rid> ends with the processor architecture. e.g. fedora-x64.
155
-
156
157
string assemblyDirectory = Path . GetDirectoryName ( typeof ( NativeMethods ) . Assembly . Location ) ;
157
158
string processorArchitecture = RuntimeInformation . ProcessArchitecture . ToString ( ) . ToLowerInvariant ( ) ;
158
159
foreach ( var runtimeFolder in Directory . GetDirectories ( Path . Combine ( assemblyDirectory , "runtimes" ) , $ "*-{ processorArchitecture } ") )
@@ -164,6 +165,7 @@ private static IntPtr ResolveDll(string libraryName, Assembly assembly, DllImpor
164
165
}
165
166
}
166
167
}
168
+ #endif
167
169
}
168
170
return handle ;
169
171
}
0 commit comments