/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void packageManger_PackageInstalled(object sender, NuGet.PackageOperationEventArgs e) { //Copy the package files out to the correct locations e.Package.CopyPackageFiles(); //If package has old format package.xml - lets try & improt doctypes & content etc... e.Package.InstallFromPackageXml(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void packageManger_PackageUninstalled(object sender, NuGet.PackageOperationEventArgs e) { //Try & run OLD Legacy event - AfterDelete of package aka uninstall/remove/delete //umbraco.cms.businesslogic.packager.InstalledPackage.FireAfterDelete //Remove the package files e.Package.RemovePackageFiles(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void packageManger_PackageUninstalling(object sender, NuGet.PackageOperationEventArgs e) { //If package has old format package.xml - lets try & uninstall - Run uninstall/undo package actions e.Package.UninstallFromPackageXml(); //Try & run OLD Legacy event - BeforeDelete of Package aka uninstall/remove/delete //umbraco.cms.businesslogic.packager.InstalledPackage.FireBeforeDelete }
void PackageInstalled (object sender, PackageOperationEventArgs e) { if (e.Package.Id != PackageId) { return; } ReadMeFile = FindReadMeFileInPackage (e.InstallPath, e.Package); }
private void events_AddInPackageDownloaded(object sender, PackageOperationEventArgs e) { try { InstallAddIn(e.Package, e.InstallPath); } catch (Exception ex) { _events.OnAddInOperationError(new AddInOperationErrorEventArgs(ex)); } }
private void OnPackageInstalled(object sender, NuGet.PackageOperationEventArgs args) { var packageInstallPath = Path.Combine(args.InstallPath, "tools\\packageinstall.exe"); if (File.Exists(packageInstallPath)) { RunPackageInstall(packageInstallPath, "/install", currentProgressReport); } NugetPackageInstalled?.Invoke(sender, new PackageOperationEventArgs(args)); }
private void OnPackageManagerPackageUninstalling(object sender, PackageOperationEventArgs e) { var package = e.Package; var unistallPackageFile = package.GetUninstallPackageFile(); this.shellPackageFile.Execute(unistallPackageFile, package, this.logger); if (this.installCalled) { return; } var teardownPackageFile = package.GetTeardownPackageFile(); this.shellPackageFile.Execute(teardownPackageFile, package, this.logger); }
private void OnPackageUninstalling(object sender, NuGet.PackageOperationEventArgs args) { NugetPackageUninstalling?.Invoke(sender, new PackageOperationEventArgs(args)); try { var packageInstallPath = Path.Combine(args.InstallPath, "tools\\packageinstall.exe"); if (File.Exists(packageInstallPath)) { RunPackageInstall(packageInstallPath, "/uninstall", currentProgressReport); } } catch (Exception) { // We mute errors during uninstall since they are usually non-fatal (OTOH, if we don't catch the exception, the NuGet package isn't uninstalled, which is probably not what we want) // If we really wanted to deal with them at some point, we should use another mechanism than exception (i.e. log) } }
public void FirePackageReferenceAddedEvent(PackageOperationEventArgs e) { if (PackageReferenceAdded != null) { PackageReferenceAdded(this, e); } }
void PackageInstalled(object sender, PackageOperationEventArgs e) { RunInitScript(e); }
protected virtual void OnRemoveFiles(PackageOperationEventArgs e) { RemoveFiles(e.Package); }
protected virtual void OnInstalling(PackageOperationEventArgs e) { if (PackageInstalling != null) { PackageInstalling(this, e); } }
protected virtual void OnPackageReferenceRemoved (PackageOperationEventArgs eventArgs) { if (PackageReferenceRemoved != null) { PackageReferenceRemoved (this, eventArgs); } }
private void manager_PackageUninstalled(object sender, PackageOperationEventArgs e) { Log.Editor.Write("Package removal scheduled: {0}, {1}", e.Package.Id, e.Package.Version); // Determine all files that are referenced by a package, and the ones referenced by this one IEnumerable<string> localFiles = this.CreateFileMapping(e.Package).Select(p => p.Key); // Schedule files for removal XDocument updateDoc = this.PrepareUpdateFile(); foreach (var packageFile in localFiles) { // Don't remove any file that is still referenced by a local package bool stillInUse = false; foreach (NuGet.IPackage localNugetPackage in this.manager.LocalRepository.GetPackages()) { Dictionary<string,string> localMapping = this.CreateFileMapping(localNugetPackage); if (localMapping.Any(p => PathHelper.Equals(p.Key, packageFile))) { stillInUse = true; break; } } if (stillInUse) continue; // Append the scheduled operation to the updater config file. this.AppendUpdateFileEntry(updateDoc, packageFile); } updateDoc.Save(this.UpdateFilePath); // Update local package configuration file this.localPackages.RemoveAll(p => p.Id == e.Package.Id); this.SaveConfig(); }
void FirePackageInstalledEvent(IPackageManagementProject project, PackageOperationEventArgs eventArgs) { project.Raise(p => p.PackageInstalled += null, null, eventArgs); }
private void _packageEvents_NuGetPackageUninstalled(object sender, PackageOperationEventArgs e) { _events.OnAddInPackageRemoved(e); }
private void _packageEvents_NuGetPackageInstalled(object sender, PackageOperationEventArgs e) { // NuGet package has been downloaded and extracted, now install the AddIn from it // TODO Error management? _events.OnAddInPackageDownloaded(e); }
private void OnPackageUninstalled(object sender, NuGet.PackageOperationEventArgs args) { NugetPackageUninstalled?.Invoke(sender, new PackageOperationEventArgs(args)); }
private void RemovePackageReferenceFromProject(IPackage package) { string packageFullName = package.GetFullName(); Logger.Log(MessageLevel.Verbose, NuGetResources.Log_BeginRemovePackageReference, packageFullName, Project.ProjectName); PackageOperationEventArgs args = CreateOperation(package); OnPackageReferenceRemoving(args); if (args.Cancel) { return; } // Get other packages IEnumerable <IPackage> otherPackages = from p in LocalRepository.GetPackages() where p.Id != package.Id select p; // Get other references var otherAssemblyReferences = from p in otherPackages let assemblyReferences = GetFilteredAssembliesToDelete(p) from assemblyReference in assemblyReferences ?? Enumerable.Empty <IPackageAssemblyReference>() // This can happen if package installed left the project in a bad state select assemblyReference; // Get content files from other packages // Exclude transform files since they are treated specially var otherContentFiles = from p in otherPackages from file in GetCompatibleInstalledItemsForPackage(p.Id, p.GetContentFiles()) where !IsTransformFile(file.Path) select file; // Get the files and references for this package, that aren't in use by any other packages so we don't have to do reference counting var assemblyReferencesToDelete = GetFilteredAssembliesToDelete(package) .Except(otherAssemblyReferences, PackageFileComparer.Default); var contentFilesToDelete = GetCompatibleInstalledItemsForPackage(package.Id, package.GetContentFiles()) .Except(otherContentFiles, PackageFileComparer.Default); var buildFilesToDelete = GetCompatibleInstalledItemsForPackage(package.Id, package.GetBuildFiles()); // Delete the content files Project.DeleteFiles(contentFilesToDelete, otherPackages, _fileTransformers); // Remove references foreach (IPackageAssemblyReference assemblyReference in assemblyReferencesToDelete) { Project.RemoveReference(assemblyReference.Name); } // remove the <Import> statement from projects for the .targets and .props files foreach (var importFile in buildFilesToDelete) { string fullImportFilePath = Path.Combine(PathResolver.GetInstallPath(package), importFile.Path); Project.RemoveImport(fullImportFilePath); } // Remove package to the repository LocalRepository.RemovePackage(package); Logger.Log(MessageLevel.Verbose, NuGetResources.Log_SuccessfullyRemovedPackageReference, packageFullName, Project.ProjectName); OnPackageReferenceRemoved(args); }
protected virtual void OnExpandFiles(PackageOperationEventArgs e) { ExpandFiles(e.Package); }
public void FirePackageReferenceRemovingEvent(PackageOperationEventArgs e) { if (PackageReferenceRemoving != null) { PackageReferenceRemoving(this, e); } }
private void manager_PackageInstalled(object sender, PackageOperationEventArgs e) { Log.Editor.Write("Package downloaded: {0}, {1}", e.Package.Id, e.Package.Version); // Schedule files for updating / copying XDocument updateDoc = this.PrepareUpdateFile(); Dictionary<string,string> fileMapping = this.CreateFileMapping(e.Package); foreach (var pair in fileMapping) { // Don't overwrite files from a newer version of this package with their old one (think of dependencies) bool isOldVersion = false; foreach (NuGet.IPackage localNugetPackage in this.manager.LocalRepository.GetPackages()) { if (localNugetPackage.Id != e.Package.Id) continue; Dictionary<string,string> localMapping = this.CreateFileMapping(localNugetPackage); if (localMapping.Any(p => PathHelper.Equals(p.Key, pair.Key))) { if (localNugetPackage.Version > e.Package.Version) { isOldVersion = true; break; } } } if (isOldVersion) continue; // Append the scheduled operation to the updater config file. this.AppendUpdateFileEntry(updateDoc, Path.Combine(e.InstallPath, pair.Value), pair.Key); } updateDoc.Save(this.UpdateFilePath); }
void FirePackageReferenceRemovingEvent(IPackageManagementProject project, PackageOperationEventArgs eventArgs) { project.Raise(p => p.PackageReferenceRemoving += null, null, eventArgs); }
public void FirePackageReferenceRemoved (PackageOperationEventArgs eventArgs) { OnPackageReferenceRemoved (eventArgs); }
void PackageReferenceAdded (object sender, PackageOperationEventArgs e) { packagesUpdated = true; }
public void PackageUninstalled_PackagerManagerPackageUninstalledEventFired_EventFiresWithPackage() { CreateProject(); PackageOperationEventArgs eventArgs = null; project.PackageUninstalled += (sender, e) => eventArgs = e; var expectedEventArgs = new PackageOperationEventArgs(new FakePackage(), null, String.Empty); fakePackageManager.FirePackageUninstalled(expectedEventArgs); Assert.AreEqual(expectedEventArgs, eventArgs); }
void PackageReferenceAdded(object sender, PackageOperationEventArgs e) { RunInstallScript(e); }
void PackageInstalled(IPackageManagementProject project, PackageOperationEventArgs e) { RunInitScript(project, e); }
protected virtual void OnUninstalled(PackageOperationEventArgs e) { if (PackageUninstalled != null) { PackageUninstalled(this, e); } }
void PackageReferenceRemoving(IPackageManagementProject project, PackageOperationEventArgs e) { RunUninstallScript(project, e); }
void PackageReferenceRemoved(object sender, PackageOperationEventArgs e) { RunUninstallScript(e); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void packageManger_PackageInstalling(object sender, NuGet.PackageOperationEventArgs e) { }
void RunInstallScript(PackageOperationEventArgs e) { IPackageScript script = scriptFactory.CreatePackageInstallScript(e.Package, e.InstallPath); RunScript(script); }
protected virtual void OnInstalled(PackageOperationEventArgs e) { if (_packageInstalled != null) { _packageInstalled(this, e); } }
void PackageReferenceAdded(IPackageManagementProject project, PackageOperationEventArgs e) { RunInstallScript(project, e); }
private void OnUninstalling(PackageOperationEventArgs e) { if (_packageUninstalling != null) { _packageUninstalling(this, e); } }
void RunUninstallScript(IPackageManagementProject project, PackageOperationEventArgs e) { IPackageScript script = scriptFactory.CreatePackageUninstallScript(e.Package, e.InstallPath); RunScript(project, script); }
public void FirePackageUninstalledEvent(PackageOperationEventArgs e) { if (PackageUninstalled != null) { PackageUninstalled(this, e); } }