Skip to content

Commit

Permalink
Special case System.Net.http - fixes #2352
Browse files Browse the repository at this point in the history
  • Loading branch information
forki committed Aug 18, 2017
1 parent 4fb5bec commit d69532c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/Paket.Core/Installation/RestoreProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ let CreateInstallModel(alternativeProjectRoot, root, groupName, sources, caches,
let! (package, content) = ExtractPackage(alternativeProjectRoot, root, groupName, sources, caches, force, package, false)
let model =
InstallModel.CreateFromContent(
package.Name, package.Version,
package.Settings.FrameworkRestrictions |> Requirements.getExplicitRestriction,
package.Name,
package.Version,
Requirements.getExplicitRestriction package.Settings.FrameworkRestrictions,
content.Force())
return (groupName,package.Name), (package,model)
}
Expand Down
34 changes: 27 additions & 7 deletions src/Paket.Core/PaketConfigFiles/ProjectFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,16 @@ module ProjectFile =
| "$(TargetFrameworkIdentifier) == 'true'" -> "true"
| _ -> condition

let frameworkReferences = libFolder.FolderContents.FrameworkReferences |> Seq.sortBy (fun (r) -> r.Name) |> Seq.toList
let libraries = libFolder.FolderContents.Libraries |> Seq.sortBy (fun (r) -> r.Path) |> Seq.toList
let frameworkReferences =
libFolder.FolderContents.FrameworkReferences
|> Seq.sortBy (fun r -> r.Name)
|> Seq.toList

let libraries =
libFolder.FolderContents.Libraries
|> Seq.sortBy (fun r -> r.Path)
|> Seq.toList

let assemblyTargets = ref libFolder.Targets
let duplicates = HashSet<_>()
for frameworkAssembly in frameworkReferences do
Expand All @@ -799,7 +807,8 @@ module ProjectFile =
[condition,createItemGroup libFolder.Targets frameworkReferences libraries,false]
else
let specialFrameworkAssemblies, rest =
frameworkReferences |> List.partition (fun fr -> duplicates.Contains fr.Name)
frameworkReferences
|> List.partition (fun fr -> duplicates.Contains fr.Name)

match PlatformMatching.getCondition referenceCondition allTargets !assemblyTargets with
| "" -> [condition,createItemGroup libFolder.Targets rest libraries,false]
Expand Down Expand Up @@ -1095,10 +1104,21 @@ module ProjectFile =

let usedFrameworkLibs = HashSet<TargetProfile*string>()

completeModel
|> Seq.filter (fun kv -> usedPackages.ContainsKey kv.Key)
|> Seq.sortBy (fun kv -> let group, packName = kv.Key in group.CompareString, packName.CompareString)
|> Seq.map (fun kv ->
let httpPackage = PackageName "System.Net.Http"
let filteredModel =
completeModel
|> Map.filter (fun kv _ -> usedPackages.ContainsKey kv)


filteredModel
|> Seq.sortBy (fun kv ->
let group, packName = kv.Key
if packName = httpPackage then
for t in KnownTargetProfiles.AllProfiles do
usedFrameworkLibs.Add(t,"System.Net.Http") |> ignore

group.CompareString, packName.CompareString)
|> Seq.map (fun kv ->
deleteCustomModelNodes (snd kv.Value) project
let installSettings = snd usedPackages.[kv.Key]
let restrictionList =
Expand Down
2 changes: 1 addition & 1 deletion src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<StartProgram>paket.exe</StartProgram>
<StartAction>Project</StartAction>
<StartArguments>update</StartArguments>
<StartWorkingDirectory>C:\temp\Library2</StartWorkingDirectory>
<StartWorkingDirectory>C:\temp\fixed</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
Expand Down

0 comments on commit d69532c

Please sign in to comment.