Updated Dependency to accept DependencyName as parameter

This commit is contained in:
2024-06-07 21:01:10 +03:00
parent 1a5f0cbede
commit 9a8ddb5388
14 changed files with 152 additions and 83 deletions

View File

@@ -69,9 +69,11 @@ public static class Entry
static Assembly LoadFromSameFolder(object sender, ResolveEventArgs args)
{
var folderPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "./Libraries");
string requestingAssembly = args.RequestingAssembly?.GetName().Name;
var folderPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, $"Libraries\\{requestingAssembly}");
var assemblyPath = Path.Combine(folderPath, new AssemblyName(args.Name).Name + ".dll");
if (!File.Exists(assemblyPath)) return null;
if (!File.Exists(assemblyPath))
return null;
var assembly = Assembly.LoadFrom(assemblyPath);
return assembly;