FileInfo f = new FileInfo(dllPath);
if (File.Exists(f.FullName))
{
- Assembly asm = CurrentAssemblyLoaderContext.LoadFromAssemblyPath(f.FullName);
+ Assembly asm = null;
+ if (0 == string.Compare(f.FullName, f.FullName.Length - 7, ".ni", 0, 3, StringComparison.OrdinalIgnoreCase))
+ {
+ asm = CurrentAssemblyLoaderContext.LoadFromNativeImagePath(f.FullName, null);
+ }
+ else
+ {
+ asm = CurrentAssemblyLoaderContext.LoadFromAssemblyPath(f.FullName);
+ }
+
if (asm == null) throw new FileNotFoundException($"{f.FullName} is not found");
if (asm.EntryPoint == null) throw new ArgumentException($"{f.FullName} did not have EntryPoint");
asm.EntryPoint.Invoke(null, new object[]{argv});