@@ -446,40 +446,42 @@ let combineRestrictions loose (x : FrameworkRestriction) y =
446446 []
447447
448448let filterRestrictions ( list1 : FrameworkRestrictions ) ( list2 : FrameworkRestrictions ) =
449- let list1 = getRestrictionList list1
450- let list2 = getRestrictionList list2
451-
452- let filtered =
453- match list1, list2 with
454- | [],_ -> list2
455- | _,[] -> list1
456- | _ ->
457- [ for x in list1 do
458- for y in list2 do
459- let c = combineRestrictions false x y
460- if c <> [] then yield ! c]
461-
462- let tryLoose =
463- ( filtered |> List.exists ( fun r -> match r.GetOneIdentifier with | Some ( FrameworkIdentifier.DotNetFramework _ ) -> true | _ -> false ) |> not ) &&
464- ( list2 |> List.exists ( fun r -> match r.GetOneIdentifier with | Some ( FrameworkIdentifier.DotNetFramework _ ) -> true | _ -> false ))
465-
466- let filtered =
467- if tryLoose then
449+ match list1, list2 with
450+ | FrameworkRestrictionList [], AutoDetectFramework -> AutoDetectFramework
451+ | AutoDetectFramework, FrameworkRestrictionList [] -> AutoDetectFramework
452+ | FrameworkRestrictionList list1 , FrameworkRestrictionList list2 ->
453+ let filtered =
468454 match list1, list2 with
469455 | [],_ -> list2
470456 | _,[] -> list1
471457 | _ ->
472458 [ for x in list1 do
473459 for y in list2 do
474- let c = combineRestrictions true x y
460+ let c = combineRestrictions false x y
475461 if c <> [] then yield ! c]
476- else
477- filtered
478462
479- let optimized =
480- filtered
481- |> optimizeRestrictions
482- FrameworkRestrictionList optimized
463+ let tryLoose =
464+ ( filtered |> List.exists ( fun r -> match r.GetOneIdentifier with | Some ( FrameworkIdentifier.DotNetFramework _ ) -> true | _ -> false ) |> not ) &&
465+ ( list2 |> List.exists ( fun r -> match r.GetOneIdentifier with | Some ( FrameworkIdentifier.DotNetFramework _ ) -> true | _ -> false ))
466+
467+ let filtered =
468+ if tryLoose then
469+ match list1, list2 with
470+ | [],_ -> list2
471+ | _,[] -> list1
472+ | _ ->
473+ [ for x in list1 do
474+ for y in list2 do
475+ let c = combineRestrictions true x y
476+ if c <> [] then yield ! c]
477+ else
478+ filtered
479+
480+ let optimized =
481+ filtered
482+ |> optimizeRestrictions
483+ FrameworkRestrictionList optimized
484+ | _ -> failwithf " The framework restriction %O and %O could not be combined." list1 list2
483485
484486/// Get if a target should be considered with the specified restrictions
485487let isTargetMatchingRestrictions =
0 commit comments