public static async Task <int> ExecuteAsync( PluginOptions options, IConsole console, IAppEnvironment appEnvironment, InvocationContext context = null) { console.Out.WriteLine($"Installing plugin from package '{options.PackageId}'"); var packageManager = new NuGetPluginPackageManager(appEnvironment); try { PluginPackage result = await packageManager.InstallLatestAsync(options.PackageId).ConfigureAwait(false); console.Out.WriteLine($"Using plugin version {result.Version}"); console.Out.WriteLine($"Installed plugin {result.Name} to {result.PluginPath}"); } catch (System.IO.IOException) { console.Out.WriteLine("The latest version of this plugin is already installed."); return(ReturnCodes.Error); } return(ReturnCodes.Ok); }
public static async Task <int> ExecuteAsync( PluginOptions options, IConsole console, IAppEnvironment appEnvironment, InvocationContext context = null) { console.Out.WriteLine($"Uninstalling plugin with package id '{options.PackageId}'"); var packageManager = new NuGetPluginPackageManager(appEnvironment); try { await packageManager.UninstallAsync(options.PackageId).ConfigureAwait(false); } catch (Exception exception) { console.Error.WriteLine(exception.Message); return(ReturnCodes.Exception); } return(ReturnCodes.Ok); }