From acabe40bc784453f7f3eb984f342dad3f6bd9596 Mon Sep 17 00:00:00 2001 From: Isaac Abraham Date: Fri, 2 Jan 2015 19:02:49 +0000 Subject: [PATCH] Fixes #506 --- src/Paket.Core/InstallProcess.fs | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/src/Paket.Core/InstallProcess.fs b/src/Paket.Core/InstallProcess.fs index 2e5c639fe4..f283027d32 100644 --- a/src/Paket.Core/InstallProcess.fs +++ b/src/Paket.Core/InstallProcess.fs @@ -93,30 +93,26 @@ let createModel(root, sources,force, lockFile:LockFile) = extractedPackages -/// Picks the highest version of a library -let private pickHighestLibraryVersion libraries = - libraries - |> Seq.sortBy (fun p -> FileVersionInfo.GetVersionInfo(p).FileVersion) - |> Seq.last - /// Applies binding redirects for all strong-named references to all app. and web. config files. let private applyBindingRedirects root extractedPackages = extractedPackages |> Seq.map(fun (package, model:InstallModel) -> model.GetReferences.Force()) |> Set.unionMany - |> Seq.choose(fun ref -> - match ref with - | Reference.Library path -> Some path - | _-> None) + |> Seq.choose(function | Reference.Library path -> Some path | _-> None) |> Seq.groupBy (fun p -> FileInfo(p).Name) - |> Seq.map(fun (_,libraries) -> pickHighestLibraryVersion libraries) - |> Seq.choose(fun assemblyFileName -> - try - let assembly = Assembly.ReflectionOnlyLoadFrom assemblyFileName - assembly - |> BindingRedirects.getPublicKeyToken - |> Option.map(fun token -> assembly, token) - with exn -> None) + |> Seq.choose(fun (_,librariesForPackage) -> + librariesForPackage + |> Seq.choose(fun library -> + try + let assembly = Assembly.ReflectionOnlyLoadFrom library + assembly + |> BindingRedirects.getPublicKeyToken + |> Option.map(fun token -> assembly, token) + with exn -> None) + |> Seq.sortBy(fun (assembly,_) -> assembly.GetName().Version) + |> Seq.toList + |> List.rev + |> function | head :: _ -> Some head | _ -> None) |> Seq.map(fun (assembly, token) -> { BindingRedirect.AssemblyName = assembly.GetName().Name Version = assembly.GetName().Version.ToString()