@@ -600,6 +600,13 @@ type Dependencies(dependenciesFileName: string) =
600600 |> Seq.map ( fun kv -> kv.Key.ToString())
601601 |> Seq.toList
602602
603+ member __.GetConditions (): string list =
604+ let dependenciesFile = DependenciesFile.ReadFromFile dependenciesFileName
605+ dependenciesFile.Groups
606+ |> Seq.choose ( fun kv -> kv.Value.Options.Settings.ReferenceCondition)
607+ |> Seq.distinct
608+ |> Seq.toList
609+
603610 /// Returns the direct dependencies for the given package.
604611 member this.GetDirectDependenciesForPackage ( groupName , packageName : string ): ( string * string * string ) list =
605612 let resolvedPackages = this.GetLockFile() .GetGroupedResolution()
@@ -855,6 +862,9 @@ type Dependencies(dependenciesFileName: string) =
855862 doc.Save fileStream
856863
857864 static member FixNuspecs ( projectFile : ProjectFile , referencesFile : ReferencesFile , nuspecFileList : string list ) =
865+ Dependencies.FixNuspecs ( projectFile, referencesFile, nuspecFileList, [])
866+
867+ static member FixNuspecs ( projectFile : ProjectFile , referencesFile : ReferencesFile , nuspecFileList : string list , conditions : string list ) =
858868 let attr ( name : string ) ( node : XmlNode ) =
859869 match node.Attributes.[ name] with
860870 | null -> None
@@ -880,8 +890,14 @@ type Dependencies(dependenciesFileName: string) =
880890 |> List.map ( fun proj -> proj.NameWithoutExtension)
881891 |> Set.ofList
882892 let depsFile = deps.GetDependenciesFile()
893+ let groupMatchesConditions groupName =
894+ let group = depsFile.GetGroup( groupName)
895+ match group.Options.Settings.ReferenceCondition with
896+ | None -> true
897+ | Some condition -> conditions |> List.contains condition
883898 let allFrameworkRestrictions =
884899 locked.GetPackageHull referencesFile
900+ |> Seq.filter ( fun kvp -> fst kvp.Key |> groupMatchesConditions)
885901 |> Seq.map( fun kvp -> snd kvp.Key, fst kvp.Key, kvp.Value.Settings.FrameworkRestrictions.GetExplicitRestriction())
886902
887903
@@ -898,6 +914,7 @@ type Dependencies(dependenciesFileName: string) =
898914
899915 let projectReferencedDeps =
900916 referencesFile.Groups
917+ |> Seq.filter ( fun ( KeyValue ( group , _ )) -> group |> groupMatchesConditions)
901918 |> Seq.collect ( fun ( KeyValue ( group , packages )) -> packages.NugetPackages |> Seq.map ( fun p -> group, p))
902919
903920 let groupsForProjectReferencedDeps =
0 commit comments