@@ -189,35 +189,28 @@ let InstallIntoProjects(sources, options : InstallerOptions, lockFile : LockFile
189189 | Some p -> p
190190 | None -> failwithf " %s uses NuGet package %O , but it was not found in the paket.lock file." referenceFile.FileName ps.Name
191191
192- ps.Name,
193- { ps.Settings with
194- FrameworkRestrictions =
195- // TODO: This should filter
196- ps.Settings.FrameworkRestrictions @
197- lockFile.Options.Settings.FrameworkRestrictions @
198- package.Settings.FrameworkRestrictions
199-
200- ImportTargets =
201- ps.Settings.ImportTargets ++
202- package.Settings.ImportTargets ++
203- lockFile.Options.Settings.ImportTargets
204-
205- CopyLocal =
206- ps.Settings.CopyLocal ++
207- package.Settings.CopyLocal ++
208- lockFile.Options.Settings.CopyLocal
209-
210- OmitContent =
211- ps.Settings.OmitContent ++
212- package.Settings.OmitContent ++
213- lockFile.Options.Settings.OmitContent })
192+ let resolvedSettings = [ lockFile.Options.Settings; package.Settings;] |> List.fold (+) ps.Settings
193+ ps.Name, resolvedSettings
194+ )
214195 |> Map.ofSeq
215196
216197
217198 let usedPackages =
218199 let d = ref usedPackages
219200
220- for name, settings in usedPackages |> Seq.collect ( fun u -> lookup.[ NormalizedPackageName u.Key] |> Seq.map ( fun x -> x, u.Value)) do
201+ /// we want to thread the settings from the references file through the computation so that it can be used as the base that
202+ /// the other settings modify. in this way we ensure that references files can override the dependencies file, which in turn overrides the lockfile.
203+ let usedPackageDependencies =
204+ usedPackages
205+ |> Seq.collect ( fun u -> lookup.[ NormalizedPackageName u.Key] |> Seq.map ( fun i -> u.Value, i))
206+ |> Seq.choose ( fun ( parentSettings , dep ) ->
207+ match packages |> Map.tryFind ( NormalizedPackageName dep) with
208+ | None -> None
209+ | Some p ->
210+ let resolvedSettings = [ lockFile.Options.Settings; p.Settings;] |> List.fold (+) parentSettings
211+ Some ( p.Name, resolvedSettings) )
212+
213+ for name, settings in usedPackageDependencies do
221214 if (! d) .ContainsKey name |> not then
222215 d := Map.add name settings ! d
223216
0 commit comments