Repository navigation
Fixes an issue where the binding redirect version is picked from the fir... #422
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
@@ -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) | ||
| |> Seq.last | ||
|
|
||
| /// Applies binding redirects for all strong-named references to all app. and web. config files. | ||
| let private applyBindingRedirects root extractedPackages = | ||
| extractedPackages | ||
|
|
@@ -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) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just followed from the extractedPackages and made the assumption p = package
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all of it or just my changes?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the
FileVersionthe same as theAssembly.GetName().Version, could them be different?There was a problem hiding this comment.
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 .
There was a problem hiding this comment.
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:
With this the ordering can get wrong as well.
We should use the
AssemblyName.Version.