Skip to content
Merged
Changes from 1 commit
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 package
let private pickHighestPackageVersion packages =
packages
|> Seq.sortBy (fun p -> FileVersionInfo.GetVersionInfo(p).FileVersion)

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

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 (_,ps) -> pickHighestPackageVersion ps)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the issue is that we're not talking about packages here.
We have libs with conflicting version nos.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just followed from the extractedPackages and made the assumption p = package

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yep sorry that's my fault. Should have made it more explicit. p is a library path in this case.
Could you please fix this with your PR? Thanks

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

all of it or just my changes?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No it's just in the lines you touched.

|> Seq.choose(fun assemblyFileName ->
try
let assembly = Assembly.ReflectionOnlyLoadFrom assemblyFileName
Expand Down