예제 #1
0
        Queue <NuGetPackageNode> GetPackageRoots(IDictionary <string, NuGetPackageNode> packages, Trimmable trimmable)
        {
            var packageRootQueue = new Queue <NuGetPackageNode>();

            if (RootPackages != null)
            {
                var rootPackageIds = RootPackages.Select(i => GetPackageIdFromItemSpec(i.ItemSpec));

                foreach (var rootPackageId in rootPackageIds)
                {
                    NuGetPackageNode rootPackage;

                    if (!packages.TryGetValue(rootPackageId, out rootPackage))
                    {
                        throw new Exception($"Root package {rootPackageId} was specified but was not found in PackageDependencies");
                    }

                    if (!IsPackageTrimmable(rootPackage))
                    {
                        IncludeNode(packageRootQueue, rootPackage);
                    }
                }
            }

            return(packageRootQueue);
        }
예제 #2
0
        Queue <NuGetPackageNode> GetPackageRoots(IDictionary <string, NuGetPackageNode> packages, Trimmable trimmable)
        {
            var packageRootQueue = new Queue <NuGetPackageNode>();

            if (RootPackages != null)
            {
                var rootPackageIds = RootPackages.Select(i => GetPackageIdFromItemSpec(i.ItemSpec));

                var trimmedRootPackageIds = rootPackageIds.Where(p => !trimmable.IsPackageTrimmable(p));

                foreach (var rootPackageId in trimmedRootPackageIds)
                {
                    NuGetPackageNode rootPackage;

                    if (!packages.TryGetValue(rootPackageId, out rootPackage))
                    {
                        throw new Exception($"Root package {rootPackageId} was specified but was not found in {AssetsFilePath}");
                    }

                    IncludeNode(packageRootQueue, rootPackage);
                }
            }

            return(packageRootQueue);
        }