async Task RestoreAnyMissingPackages(CancellationToken cancellationToken)
        {
            var packages = await restoreManager.GetPackagesInSolutionAsync(
                solutionManager.SolutionDirectory,
                cancellationToken);

            var missingPackages = packages.Select(IsMissingForCurrentProject).ToList();

            if (missingPackages.Any())
            {
                using (var monitor = new PackageRestoreMonitor(restoreManager, packageManagementEvents)) {
                    using (var cacheContext = new SourceCacheContext()) {
                        var downloadContext = new PackageDownloadContext(cacheContext);
                        await restoreManager.RestoreMissingPackagesAsync(
                            solutionManager.SolutionDirectory,
                            project,
                            context,
                            downloadContext,
                            cancellationToken);
                    }
                }

                await RunInMainThread(() => dotNetProject.RefreshReferenceStatus());

                packageManagementEvents.OnPackagesRestored();
            }
        }
Beispiel #2
0
        async Task ExecuteAsync(CancellationToken cancellationToken)
        {
            if (referencingProjects == null)
            {
                await packageRestorer.RestorePackages(nugetProject, cancellationToken);
            }
            else
            {
                await RestoreMultiplePackages(cancellationToken);
            }

            await Runtime.RunInMainThread(() => project.RefreshReferenceStatus());

            packageManagementEvents.OnPackagesRestored();
        }