示例#1
0
        private static bool AreCompatible(TargetFrameworkMetadata projectFramework, IEnumerable <NuGetFramework> packageFrameworks)
        {
            var reducer = new FrameworkReducer();

            var nearest = reducer.GetNearest(ParseFrameworkName(projectFramework.TargetFrameworkShortName), packageFrameworks);

            if (nearest == null)
            {
                foreach (var import in projectFramework.Imports)
                {
                    nearest = reducer.GetNearest(ParseFrameworkName(import), packageFrameworks);
                    if (nearest != null)
                    {
                        break;
                    }
                }
            }
            return(nearest != null);
        }
示例#2
0
        public static bool AreCompatible(TargetFrameworkMetadata projectFramework, IEnumerable <string> packageFrameworks)
        {
            var nugetPackageFrameworks = packageFrameworks.Select(x => ParseFrameworkName(x));

            return(AreCompatible(projectFramework, nugetPackageFrameworks));
        }