public void Open(string contractName) { _catalog = AppExtensionCatalog.Open(contractName); _catalog.PackageInstalled += (s, e) => PackageInstalled?.Invoke(this, new AppExtensionPackageInstalledEventArgsWrapper(e)); _catalog.PackageUpdated += (s, e) => PackageUpdated?.Invoke(this, new AppExtensionPackageUpdatedEventArgsWrapper(e)); _catalog.PackageUninstalling += (s, e) => PackageUninstalling?.Invoke(this, new AppExtensionPackageUninstallingEventArgsWrapper(e)); _catalog.PackageUpdating += (s, e) => PackageUpdating?.Invoke(this, new AppExtensionPackageUpdatingEventArgsWrapper(e)); _catalog.PackageStatusChanged += (s, e) => PackageStatusChanged?.Invoke(this, new AppExtensionPackageStatusChangedEventArgsWrapper(e)); }
public async Task UninstallAsync(IEnumerable <NuGetProject> projects, IEnumerable <string> packages, bool removeDependencies, bool forceRemove, bool shouldThrow, CancellationToken token) { MyProjectContext projectContext = new MyProjectContext(FileConflictAction.OverwriteAll) { ActionType = NuGetActionType.Uninstall, PackageExtractionContext = _packageExtractionContext }; // sort packages // packages = SortPackagesWhenUninstallAsync(projects, packages); foreach (string packageId in packages) { var uninstallationContext = new UninstallationContext(removeDependencies, forceRemove); IReadOnlyList <ResolvedAction> actions = await GetActionsForUninstallAsync( uninstallationContext : uninstallationContext, targets : projects, packageId : packageId, projectContext : projectContext, token : token); if (actions.Count != 0) { PackageUninstalling?.Invoke(packageId); try { await ExecuteActionsAsync(actions, null, projectContext, NullSourceCacheContext.Instance, token); } catch (Exception ex) { Debug.WriteLine(ex); if (shouldThrow) { throw; } } finally { PackageUninstalled?.Invoke(packageId); } } } }
private void NuGetPackageUninstalling(string packageId) { PackageUninstalling?.Invoke(packageId); }
public void OnPackageUninstalling(IDotNetProject project, NuGet.ProjectManagement.PackageEventArgs e) { PackageUninstalling?.Invoke(this, new PackageManagementEventArgs(project, e)); }