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(); })); }