@@ -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()
@@ -854,7 +861,7 @@ type Dependencies(dependenciesFileName: string) =
854861 use fileStream = File.Open ( nuspecFile, FileMode.Create)
855862 doc.Save fileStream
856863
857- static member FixNuspecs ( projectFile : ProjectFile , referencesFile : ReferencesFile , nuspecFileList : string list ) =
864+ static member FixNuspecs ( projectFile : ProjectFile , referencesFile : ReferencesFile , nuspecFileList : string list , conditions : string list ) =
858865 let attr ( name : string ) ( node : XmlNode ) =
859866 match node.Attributes.[ name] with
860867 | null -> None
@@ -880,8 +887,14 @@ type Dependencies(dependenciesFileName: string) =
880887 |> List.map ( fun proj -> proj.NameWithoutExtension)
881888 |> Set.ofList
882889 let depsFile = deps.GetDependenciesFile()
890+ let groupMatchesConditions groupName =
891+ let group = depsFile.GetGroup( groupName)
892+ match group.Options.Settings.ReferenceCondition with
893+ | None -> true
894+ | Some condition -> conditions |> List.contains condition
883895 let allFrameworkRestrictions =
884896 locked.GetPackageHull referencesFile
897+ |> Seq.filter ( fun kvp -> fst kvp.Key |> groupMatchesConditions)
885898 |> Seq.map( fun kvp -> snd kvp.Key, fst kvp.Key, kvp.Value.Settings.FrameworkRestrictions.GetExplicitRestriction())
886899
887900
@@ -898,6 +911,7 @@ type Dependencies(dependenciesFileName: string) =
898911
899912 let projectReferencedDeps =
900913 referencesFile.Groups
914+ |> Seq.filter ( fun ( KeyValue ( group , _ )) -> group |> groupMatchesConditions)
901915 |> Seq.collect ( fun ( KeyValue ( group , packages )) -> packages.NugetPackages |> Seq.map ( fun p -> group, p))
902916
903917 let groupsForProjectReferencedDeps =
0 commit comments