public Task <UninstallResult> UninstallAsync(IManagedTemplatePackage templatePackage, IManagedTemplatePackageProvider provider, CancellationToken cancellationToken)
 {
     _ = templatePackage ?? throw new ArgumentNullException(nameof(templatePackage));
     if (!(templatePackage is NuGetManagedTemplatePackage))
     {
         return(Task.FromResult(UninstallResult.CreateFailure(templatePackage, InstallerErrorCode.UnsupportedRequest, $"{templatePackage.Identifier} is not supported by {Factory.Name}")));
     }
     try
     {
         _environmentSettings.Host.FileSystem.FileDelete(templatePackage.MountPointUri);
         return(Task.FromResult(UninstallResult.CreateSuccess(templatePackage)));
     }
     catch (Exception ex)
     {
         _environmentSettings.Host.LogDiagnosticMessage($"Uninstalling {templatePackage.DisplayName} failed.", DebugLogCategory);
         _environmentSettings.Host.LogDiagnosticMessage($"Details:{ex.ToString()}", DebugLogCategory);
         return(Task.FromResult(UninstallResult.CreateFailure(templatePackage, InstallerErrorCode.GenericError, $"Failed to uninstall {templatePackage.DisplayName}, reason: {ex.Message}")));
     }
 }
Exemplo n.º 2
0
 public Task <UninstallResult> UninstallAsync(IManagedTemplatePackage templatePackage, IManagedTemplatePackageProvider provider, CancellationToken cancellationToken)
 {
     _ = templatePackage ?? throw new ArgumentNullException(nameof(templatePackage));
     if (!(templatePackage is NuGetManagedTemplatePackage))
     {
         return(Task.FromResult(UninstallResult.CreateFailure(
                                    templatePackage,
                                    InstallerErrorCode.UnsupportedRequest,
                                    string.Format(LocalizableStrings.NuGetInstaller_InstallResut_Error_PackageNotSupported, templatePackage.DisplayName, Factory.Name))));
     }
     try
     {
         _environmentSettings.Host.FileSystem.FileDelete(templatePackage.MountPointUri);
         return(Task.FromResult(UninstallResult.CreateSuccess(templatePackage)));
     }
     catch (Exception e)
     {
         _logger.LogDebug("Uninstalling {0} failed. Details:{1}", templatePackage.DisplayName, e);
         return(Task.FromResult(UninstallResult.CreateFailure(
                                    templatePackage,
                                    InstallerErrorCode.GenericError,
                                    string.Format(LocalizableStrings.NuGetInstaller_InstallResut_Error_UninstallGeneric, templatePackage.DisplayName, e.Message))));
     }
 }
Exemplo n.º 3
0
        public Task <UninstallResult> UninstallAsync(IManagedTemplatePackage templatePackage, IManagedTemplatePackageProvider provider, CancellationToken cancellationToken)
        {
            _ = templatePackage ?? throw new ArgumentNullException(nameof(templatePackage));

            return(Task.FromResult(UninstallResult.CreateSuccess(templatePackage)));
        }