IEnumerable <PackageReference> GetPackageReferencesForSingleProject()
        {
            IPackageRepository        repository = repositoryCache.CreateAggregateRepository();
            IPackageManagementProject project    = solution.GetProject(repository, Project);

            return(project.GetPackageReferences());
        }
        public static IPackageManagementProject GetProject(this IPackageManagementSolution solution, DotNetProject project)
        {
            var projectProxy = new DotNetProjectProxy(project);
            var repository   = PackageManagementServices.PackageRepositoryCache.CreateAggregateWithPriorityMachineCacheRepository();

            return(solution.GetProject(repository, projectProxy));
        }
예제 #3
0
        public void Run(PackageReferenceNode packageReferenceNode, ProgressMonitorStatusMessage progressMessage)
        {
            try {
                IPackageManagementProject project = solution.GetProject(packageReferenceNode.Project);
                ReinstallPackageAction    action  = project.CreateReinstallPackageAction();
                action.PackageId      = packageReferenceNode.Id;
                action.PackageVersion = packageReferenceNode.Version;

                runner.Run(progressMessage, action);
            } catch (Exception ex) {
                runner.ShowError(progressMessage, ex);
            }
        }
예제 #4
0
        public void InstallPackages(
            string packageSourceUrl,
            Project project,
            IEnumerable <PackageManagementPackageReference> packages)
        {
            List <IPackageAction> actions = null;

            DispatchService.GuiSyncDispatch(() => {
                IPackageRepository repository = CreatePackageRepository(packageSourceUrl);
                IPackageManagementProject packageManagementProject = solution.GetProject(repository, new DotNetProjectProxy((DotNetProject)project));
                actions = packages.Select(packageReference => {
                    InstallPackageAction action = packageManagementProject.CreateInstallPackageAction();
                    action.PackageId            = packageReference.Id;
                    action.PackageVersion       = new SemanticVersion(packageReference.Version);
                    return((IPackageAction)action);
                }).ToList();
            });

            ProgressMonitorStatusMessage progressMessage = GetProgressMonitorStatusMessages(actions);

            backgroundActionRunner.RunAndWait(progressMessage, actions);
        }
예제 #5
0
        public void InstallPackages(
            string packageSourceUrl,
            Project project,
            IEnumerable <PackageManagementPackageReference> packages)
        {
            List <IPackageAction> actions = null;

            Runtime.RunInMainThread(() => {
                IPackageRepository repository = CreatePackageRepository(packageSourceUrl);
                IPackageManagementProject packageManagementProject = solution.GetProject(repository, new DotNetProjectProxy((DotNetProject)project));
                actions = packages.Select(packageReference => {
                    InstallPackageAction action   = packageManagementProject.CreateInstallPackageAction();
                    action.PackageId              = packageReference.Id;
                    action.PackageVersion         = new SemanticVersion(packageReference.Version);
                    action.LicensesMustBeAccepted = false;
                    return((IPackageAction)action);
                }).ToList();
            }).Wait();

            ProgressMonitorStatusMessage progressMessage = GetProgressMonitorStatusMessages(actions);

            backgroundActionRunner.Run(progressMessage, actions);
        }
        public void CheckProjectPackages(IDotNetProject project)
        {
            IPackageManagementProject packageManagementProject = solution.GetProject(registeredRepositories.ActiveRepository, project);

            packageReferenceFile = CreatePackageReferenceFile(project.GetPackagesConfigFilePath());
            packageReferences    = packageReferenceFile.GetPackageReferences().ToList();

            compatibilityReport = new ProjectPackagesCompatibilityReport(packageManagementProject.TargetFramework);

            foreach (PackageReference packageReference in packageReferences)
            {
                IPackage package = packageManagementProject.FindPackage(packageReference.Id);
                if (package != null)
                {
                    if (PackageNeedsReinstall(project, package, packageReference.TargetFramework))
                    {
                        packagesRequiringReinstallation.Add(package);
                    }
                }
            }
        }
        IPackageManagementSelectedProject CreateSelectedProject(IProject msbuildProject, IPackageFromRepository package)
        {
            IPackageManagementProject project = Solution.GetProject(package.Repository, msbuildProject);

            return(CreateSelectedProject(project, package));
        }
예제 #8
0
        IPackageManagementProject CreatePackageManagementProject(DotNetProject project)
        {
            var dotNetProject = new DotNetProjectProxy(project);

            return(packageManagementSolution.GetProject(packageRepositoryCache.CreateAggregateWithPriorityMachineCacheRepository(), dotNetProject));
        }
예제 #9
0
        public static IPackageManagementProject GetProject(this IPackageManagementSolution solution, DotNetProject project)
        {
            var projectProxy = new DotNetProjectProxy(project);

            return(solution.GetProject(projectProxy));
        }