ProgressMonitorStatusMessage CreateProgressMessage(List <UpdatePackageAction> updateActions) { if (updateActions.Count == 1) { return(ProgressMonitorStatusMessageFactory.CreateUpdatingSinglePackageMessage(updateActions.First().PackageId)); } return(ProgressMonitorStatusMessageFactory.CreateUpdatingPackagesInProjectMessage(updateActions.Count)); }
public void UpdatePackage() { var packageReferenceNode = (PackageReferenceNode)CurrentNode.DataItem; ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateUpdatingSinglePackageMessage(packageReferenceNode.Id); try { IPackageManagementProject project = PackageManagementServices.Solution.GetActiveProject(); UpdatePackageAction action = project.CreateUpdatePackageAction(); action.PackageId = packageReferenceNode.Id; PackageManagementServices.BackgroundPackageActionRunner.Run(progressMessage, action); } catch (Exception ex) { PackageManagementServices.BackgroundPackageActionRunner.ShowError(progressMessage, ex); } }
internal static void UpdatePackage(IDotNetProject project, string packageId, bool includePrerelease) { try { var solutionManager = PackageManagementServices.Workspace.GetSolutionManager(project.ParentSolution); var action = new UpdateNuGetPackageAction(solutionManager, project) { PackageId = packageId, IncludePrerelease = includePrerelease }; ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateUpdatingSinglePackageMessage(packageId, project); UpdatePackage(progressMessage, action); } catch (Exception ex) { ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateUpdatingSinglePackageMessage(packageId); PackageManagementServices.BackgroundPackageActionRunner.ShowError(progressMessage, ex); } }
public void UpdatePackage() { var packageReferenceNode = (PackageReferenceNode)CurrentNode.DataItem; try { IPackageManagementProject project = PackageManagementServices.Solution.GetActiveProject(); ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateUpdatingSinglePackageMessage(packageReferenceNode.Id, project); UpdatePackageAction action = project.CreateUpdatePackageAction(); action.PackageId = packageReferenceNode.Id; action.AllowPrereleaseVersions = !packageReferenceNode.IsReleaseVersion(); RestoreBeforeUpdateAction.Restore(project, () => { UpdatePackage(progressMessage, action); }); } catch (Exception ex) { ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateUpdatingSinglePackageMessage(packageReferenceNode.Id); PackageManagementServices.BackgroundPackageActionRunner.ShowError(progressMessage, ex); } }
public void UpdatePackage() { var packageReferenceNode = (PackageReferenceNode)CurrentNode.DataItem; try { var solutionManager = PackageManagementServices.Workspace.GetSolutionManager(packageReferenceNode.Project.ParentSolution); var action = new UpdateNuGetPackageAction(solutionManager, packageReferenceNode.Project) { PackageId = packageReferenceNode.Id, IncludePrerelease = !packageReferenceNode.IsReleaseVersion() }; ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateUpdatingSinglePackageMessage(packageReferenceNode.Id, packageReferenceNode.Project); UpdatePackage(progressMessage, action); } catch (Exception ex) { ProgressMonitorStatusMessage progressMessage = ProgressMonitorStatusMessageFactory.CreateUpdatingSinglePackageMessage(packageReferenceNode.Id); PackageManagementServices.BackgroundPackageActionRunner.ShowError(progressMessage, ex); } }