Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes an issue where the binding redirect version is picked from the fir... #422

Merged
merged 4 commits into from
Dec 5, 2014
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Paket.Core/InstallProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ open System.IO
open System.Collections.Generic
open FSharp.Polyfill
open System.Reflection
open System.Diagnostics

let private findPackagesWithContent (root,usedPackages:HashSet<_>) =
usedPackages
Expand Down Expand Up @@ -95,6 +96,12 @@ let createModel(root, sources,force, lockFile:LockFile) =

extractedPackages

/// Picks the highest version of a library
let private pickHighestlibraryVersion libraries =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you adjust the casing of library to Library.

libraries
|> Seq.sortBy (fun p -> FileVersionInfo.GetVersionInfo(p).FileVersion)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the FileVersion the same as the Assembly.GetName().Version, could them be different?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FileVersion is just a string while the assembly version is an object .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beside from the types, they could differ in content.
I can annotate an assembly like this:

[<assembly: AssemblyVersionAttribute("0.17.12")>]
[<assembly: AssemblyFileVersionAttribute("0.17.12 special build")>]

With this the ordering can get wrong as well.
We should use the AssemblyName.Version.

|> Seq.last

/// Applies binding redirects for all strong-named references to all app. and web. config files.
let private applyBindingRedirects root extractedPackages =
extractedPackages
Expand All @@ -104,7 +111,8 @@ let private applyBindingRedirects root extractedPackages =
match ref with
| Reference.Library path -> Some path
| _-> None)
|> Seq.distinctBy (fun p -> FileInfo(p).Name)
|> Seq.groupBy (fun p -> FileInfo(p).Name)
|> Seq.map(fun (_,libraries) -> pickHighestlibraryVersion libraries)
|> Seq.choose(fun assemblyFileName ->
try
let assembly = Assembly.ReflectionOnlyLoadFrom assemblyFileName
Expand Down