From cdde5132f860c6f9f16a9e069134ebae63b55ac8 Mon Sep 17 00:00:00 2001 From: Sander van der Burg Date: Tue, 13 Sep 2011 20:07:14 +0000 Subject: [PATCH] Removed some obsolete restrictions, so that transitive dependencies are also loaded svn path=/nixpkgs/trunk/; revision=29249 --- .../dotnetenv/Wrapper/Wrapper/Wrapper.cs.in | 32 ++++++------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/pkgs/build-support/dotnetenv/Wrapper/Wrapper/Wrapper.cs.in b/pkgs/build-support/dotnetenv/Wrapper/Wrapper/Wrapper.cs.in index 4ea0d6ee6fa..abad090ebcb 100755 --- a/pkgs/build-support/dotnetenv/Wrapper/Wrapper/Wrapper.cs.in +++ b/pkgs/build-support/dotnetenv/Wrapper/Wrapper/Wrapper.cs.in @@ -40,37 +40,25 @@ namespace @NAMESPACE@Wrapper 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; - string assemblyPath = ""; + String assemblyPath = ""; + String requestedAssemblyName = args.Name.Substring(0, args.Name.IndexOf(",")); - AssemblyName[] referencedAssemblies = exeAssembly.GetReferencedAssemblies(); - - //Loop through the array of referenced assembly names. - foreach (AssemblyName assemblyName in referencedAssemblies) + // Search for the right path of the library assembly + foreach (String currentAssemblyPath in AssemblySearchPaths) { - //Check for the assembly names that have raised the "AssemblyResolve" event. - 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"; + assemblyPath = currentAssemblyPath + "/" + requestedAssemblyName + ".dll"; - //Search for the right path of the library assembly - foreach (String currentAssemblyPath in AssemblySearchPaths) - { - assemblyPath = currentAssemblyPath + "/" + dllName; - if (File.Exists(assemblyPath)) - break; - } - } + if (File.Exists(assemblyPath)) + break; } - //Load the assembly from the specified path. + // Load the assembly from the specified path. MyAssembly = Assembly.LoadFrom(assemblyPath); - //Return the loaded assembly. + // Return the loaded assembly. return MyAssembly; }