Esempio n. 1
0
        protected static Task RestoreDotNetCoreNuGetPackages(Solution solution)
        {
            var solutionManager = new MonoDevelopSolutionManager(solution);
            var restoreManager  = new MonoDevelopBuildIntegratedRestorer(solutionManager);

            var projects = solution.GetAllDotNetProjects().Select(p => new DotNetCoreNuGetProject(p));

            return(restoreManager.RestorePackages(
                       projects,
                       CancellationToken.None));
        }
Esempio n. 2
0
        Task UpdateNuGetPackage(DotNetProject project, string packageId, string packageVersion)
        {
            var solutionManager = new MonoDevelopSolutionManager(project.ParentSolution);
            var context         = CreateNuGetProjectContext(solutionManager.Settings);
            var sources         = solutionManager.CreateSourceRepositoryProvider().GetRepositories();

            var action = new InstallNuGetPackageAction(sources, solutionManager, new DotNetProjectProxy(project), context);

            action.LicensesMustBeAccepted = false;
            action.OpenReadmeFile         = false;
            action.PackageId = packageId;
            action.Version   = NuGetVersion.Parse(packageVersion);

            return(Task.Run(() => {
                action.Execute();
            }));
        }
Esempio n. 3
0
        protected static Task <PackageRestoreResult> RestoreNuGetPackages(Solution solution)
        {
            var solutionManager = new MonoDevelopSolutionManager(solution);
            var context         = new FakeNuGetProjectContext {
                LogToConsole = true
            };

            var restoreManager = new PackageRestoreManager(
                solutionManager.CreateSourceRepositoryProvider(),
                solutionManager.Settings,
                solutionManager
                );

            return(restoreManager.RestoreMissingPackagesInSolutionAsync(
                       solutionManager.SolutionDirectory,
                       context,
                       CancellationToken.None));
        }
        Task UpdateNuGetPackage(DotNetProject project, string packageId)
        {
            var solutionManager = new MonoDevelopSolutionManager(project.ParentSolution);
            var context         = CreateNuGetProjectContext(solutionManager.Settings);
            var packageManager  = new MonoDevelopNuGetPackageManager(solutionManager);

            var action = new UpdateNuGetPackageAction(
                solutionManager,
                new DotNetProjectProxy(project),
                context,
                packageManager,
                PackageManagementServices.PackageManagementEvents)
            {
                PackageId = packageId
            };

            return(Task.Run(() => {
                action.Execute();
            }));
        }
        Task UpdateNuGetPackage(DotNetProject[] projects, string packageId, string packageVersion)
        {
            var solutionManager = new MonoDevelopSolutionManager(projects[0].ParentSolution);
            var context         = CreateNuGetProjectContext(solutionManager.Settings);
            var sources         = solutionManager.CreateSourceRepositoryProvider().GetRepositories();

            var action = new UpdateMultipleNuGetPackagesAction(sources, solutionManager, context);

            action.LicensesMustBeAccepted = false;

            foreach (DotNetProject project in projects)
            {
                action.AddProject(new DotNetProjectProxy(project));
            }

            var packageIdentity = new PackageIdentity(packageId, NuGetVersion.Parse(packageVersion));

            action.AddPackageToUpdate(packageIdentity);

            return(Task.Run(() => {
                action.Execute();
            }));
        }
        Task UpdateNuGetPackages(DotNetProject project, IEnumerable <PackageIdentity> packages)
        {
            var solutionManager = new MonoDevelopSolutionManager(project.ParentSolution);
            var context         = CreateNuGetProjectContext(solutionManager.Settings);

            var sources = solutionManager.CreateSourceRepositoryProvider().GetRepositories().ToList();

            var action = new UpdateMultipleNuGetPackagesAction(
                sources,
                solutionManager,
                context);

            action.AddProject(new DotNetProjectProxy(project));

            foreach (var package in packages)
            {
                action.AddPackageToUpdate(package);
            }

            return(Task.Run(() => {
                action.Execute();
            }));
        }