Removed some obsolete restrictions, so that transitive dependencies are also loaded
svn path=/nixpkgs/trunk/; revision=29249
This commit is contained in:
parent
83814bdc41
commit
cdde5132f8
@ -40,37 +40,25 @@ namespace @NAMESPACE@Wrapper
|
|||||||
|
|
||||||
private Assembly MyResolveEventHandler(object sender, ResolveEventArgs args)
|
private Assembly MyResolveEventHandler(object sender, ResolveEventArgs args)
|
||||||
{
|
{
|
||||||
//This handler is called only when the common language runtime tries to bind to the assembly and fails.
|
// This handler is called only when the common language runtime tries to bind to the assembly and fails.
|
||||||
|
|
||||||
//Retrieve the list of referenced assemblies in an array of AssemblyName.
|
|
||||||
Assembly MyAssembly;
|
Assembly MyAssembly;
|
||||||
string assemblyPath = "";
|
String assemblyPath = "";
|
||||||
|
String requestedAssemblyName = args.Name.Substring(0, args.Name.IndexOf(","));
|
||||||
|
|
||||||
AssemblyName[] referencedAssemblies = exeAssembly.GetReferencedAssemblies();
|
// Search for the right path of the library assembly
|
||||||
|
foreach (String currentAssemblyPath in AssemblySearchPaths)
|
||||||
//Loop through the array of referenced assembly names.
|
|
||||||
foreach (AssemblyName assemblyName in referencedAssemblies)
|
|
||||||
{
|
{
|
||||||
//Check for the assembly names that have raised the "AssemblyResolve" event.
|
assemblyPath = currentAssemblyPath + "/" + requestedAssemblyName + ".dll";
|
||||||
if (assemblyName.FullName.Substring(0, assemblyName.FullName.IndexOf(",")) == args.Name.Substring(0, args.Name.IndexOf(",")))
|
|
||||||
{
|
|
||||||
//Retrieve the name of the assembly from where it has to be loaded.
|
|
||||||
String dllName = args.Name.Substring(0, args.Name.IndexOf(",")) + ".dll";
|
|
||||||
|
|
||||||
//Search for the right path of the library assembly
|
if (File.Exists(assemblyPath))
|
||||||
foreach (String currentAssemblyPath in AssemblySearchPaths)
|
break;
|
||||||
{
|
|
||||||
assemblyPath = currentAssemblyPath + "/" + dllName;
|
|
||||||
if (File.Exists(assemblyPath))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load the assembly from the specified path.
|
// Load the assembly from the specified path.
|
||||||
MyAssembly = Assembly.LoadFrom(assemblyPath);
|
MyAssembly = Assembly.LoadFrom(assemblyPath);
|
||||||
|
|
||||||
//Return the loaded assembly.
|
// Return the loaded assembly.
|
||||||
return MyAssembly;
|
return MyAssembly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user