src/Microsoft.PackageManagement.NuGetProvider/NugetLightClient.cs
/// <summary>
/// Get the package dependencies that we need to installed. hasDependencyLoop is set to true if dependencyloop is detected.
/// </summary>
/// <param name="request"></param>
/// <param name="packageItem"></param>
/// <param name="hasDependencyLoop"></param>
/// <returns></returns>
Get the package dependencies that we need to installed. hasDependencyLoop is set to true if dependencyloop is detected.
Get the package dependencies that we need to installed . hasDependencyLoop is set to true if dependencyloop is detected .
internal static IEnumerable<PackageItem> GetPackageDependenciesToInstall(NuGetRequest request, PackageItem packageItem, ref bool hasDependencyLoop)
        {
            request.Debug(Messages.DebugInfoCallMethod, "NuGetClient", "GetPackageDependencies");
            if (packageItem.Package == null || packageItem.Package.DependencySetList == null)
            {
                request.Debug(Messages.DebugInfoReturnCall, "NuGetClient", "GetPackageDependencies");
                return Enumerable.Empty<PackageItem>();
            }
            List<PackageItem> dependencyToBeInstalled = new List<PackageItem>();
            HashSet<PackageItem> permanentlyMarked = new HashSet<PackageItem>(new PackageItemComparer());
            HashSet<PackageItem> temporarilyMarked = new HashSet<PackageItem>(new PackageItemComparer());
            hasDependencyLoop = !DepthFirstVisit(packageItem, temporarilyMarked, permanentlyMarked, dependencyToBeInstalled, new HashSet<string>(), request);
            if (!hasDependencyLoop)
            {
                request.Debug(Messages.DebugInfoReturnCall, "NuGetClient", "GetPackageDependencies");
                dependencyToBeInstalled.RemoveAt(dependencyToBeInstalled.Count - 1);
                return dependencyToBeInstalled;
            }
            request.Debug(Messages.DebugInfoReturnCall, "NuGetClient", "GetPackageDependencies");
            return Enumerable.Empty<PackageItem>();
        }
internal static IEnumerable < PackageItem > GetPackageDependenciesToInstall ( NuGetRequest request , PackageItem packageItem , ref bool hasDependencyLoop ) { request . Debug ( Messages . DebugInfoCallMethod , " " , " " ) ; if ( packageItem . Package == null || packageItem . Package . DependencySetList == null ) { request . Debug ( Messages . DebugInfoReturnCall , " " , " " ) ; return Enumerable . Empty < PackageItem > ( ) ; } List < PackageItem > dependencyToBeInstalled = new List < PackageItem > ( ) ; HashSet < PackageItem > permanentlyMarked = new HashSet < PackageItem > ( new PackageItemComparer ( ) ) ; HashSet < PackageItem > temporarilyMarked = new HashSet < PackageItem > ( new PackageItemComparer ( ) ) ; hasDependencyLoop = ! DepthFirstVisit ( packageItem , temporarilyMarked , permanentlyMarked , dependencyToBeInstalled , new HashSet < string > ( ) , request ) ; if ( ! hasDependencyLoop ) { request . Debug ( Messages . DebugInfoReturnCall , " " , " " ) ; dependencyToBeInstalled . RemoveAt ( dependencyToBeInstalled . Count - 1 ) ; return dependencyToBeInstalled ; } request . Debug ( Messages . DebugInfoReturnCall , " " , " " ) ; return Enumerable . Empty < PackageItem > ( ) ; }
Get the package dependencies that we need to installed.
Get the package dependencies that we need to installed .
// No dependency // Returns list of dependency to be installed in the correct order that we should install them // checks that there are no dependency loop  // remove the last item of the list because that is the package itself // there are dependency loop. 
None
request
NuGetRequest
None
packageItem
PackageItem
None
bool
ref
hasDependencyLoop
None