IPackage FindPackageOrThrow(IPackageManagementProject project) { IPackage package = project.FindPackage(Id, null); if (package != null) { return(package); } throw CreatePackageNotFoundException(Id); }
void RemovePackage(PackageReferenceNode packageReferenceNode, ProgressMonitorStatusMessage progressMessage) { IPackageManagementProject project = PackageManagementServices.Solution.GetActiveProject(); UninstallPackageAction action = project.CreateUninstallPackageAction(); action.Package = project.FindPackage(packageReferenceNode.Id); if (action.Package != null) { PackageManagementServices.BackgroundPackageActionRunner.Run(progressMessage, action); } else { ShowMissingPackageError(progressMessage, packageReferenceNode); } }
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); } } } }
IPackage FindPackageOrThrow(IPackageManagementProject project) { IPackage package = project.FindPackage(Id, null); if (package != null) { return package; } throw CreatePackageNotFoundException(Id); }