public static RestoreCommandProviders Create(
            string globalFolderPath,
            IEnumerable <SourceRepository> sources,
            SourceCacheContext cacheContext,
            ILogger log)
        {
            var globalPackages       = new NuGetv3LocalRepository(globalFolderPath);
            var globalPackagesSource = Repository.Factory.GetCoreV3(globalFolderPath);

            var localProviders = new List <IRemoteDependencyProvider>()
            {
                // Do not throw or warn for gloabal cache
                new SourceRepositoryDependencyProvider(globalPackagesSource, log, cacheContext, ignoreFailedSources: true, ignoreWarning: true)
            };

            var remoteProviders = new List <IRemoteDependencyProvider>();

            foreach (var source in sources)
            {
                var provider = new SourceRepositoryDependencyProvider(source, log, cacheContext);
                remoteProviders.Add(provider);
            }

            return(new RestoreCommandProviders(globalPackages, localProviders, remoteProviders, cacheContext));
        }
        public static RestoreCommandProviders Create(
            string globalFolderPath,
            IEnumerable <string> fallbackPackageFolderPaths,
            IEnumerable <SourceRepository> sources,
            SourceCacheContext cacheContext,
            ILogger log)
        {
            var globalPackages       = new NuGetv3LocalRepository(globalFolderPath);
            var globalPackagesSource = Repository.Factory.GetCoreV3(globalFolderPath, FeedType.FileSystemV3);

            var localProviders = new List <IRemoteDependencyProvider>()
            {
                // Do not throw or warn for global cache
                new SourceRepositoryDependencyProvider(
                    globalPackagesSource,
                    log,
                    cacheContext,
                    ignoreFailedSources: true,
                    ignoreWarning: true)
            };

            // Add fallback sources as local providers also
            var fallbackPackageFolders = new List <NuGetv3LocalRepository>();

            foreach (var path in fallbackPackageFolderPaths)
            {
                var fallbackRepository = new NuGetv3LocalRepository(path);
                var fallbackSource     = Repository.Factory.GetCoreV3(path, FeedType.FileSystemV3);

                var provider = new SourceRepositoryDependencyProvider(
                    fallbackSource,
                    log,
                    cacheContext,
                    ignoreFailedSources: false,
                    ignoreWarning: false);

                fallbackPackageFolders.Add(fallbackRepository);
                localProviders.Add(provider);
            }

            var remoteProviders = new List <IRemoteDependencyProvider>();

            foreach (var source in sources)
            {
                var provider = new SourceRepositoryDependencyProvider(
                    source,
                    log,
                    cacheContext,
                    cacheContext.IgnoreFailedSources,
                    ignoreWarning: false);

                remoteProviders.Add(provider);
            }

            return(new RestoreCommandProviders(
                       globalPackages,
                       fallbackPackageFolders,
                       localProviders,
                       remoteProviders));
        }