static void Main(string[] args) { if (args.Length != 1 || string.IsNullOrEmpty(args[0])) { Console.WriteLine("Usage:\nClickOnceUninstaller appName"); return; } var appName = args[0]; var uninstallInfo = UninstallInfo.Find(appName); if (uninstallInfo == null) { Console.WriteLine("Could not find application \"{0}\"", appName); return; } Console.WriteLine("Uninstalling application \"{0}\"", appName); var uninstaller = new Uninstaller(); uninstaller.Uninstall(uninstallInfo); Console.WriteLine("Uninstall complete"); }
public static ActionResult UninstallClickOnce(Session session) { session.Log("Begin to uninstall ClickOnce deployment"); var appName = session["CLICKONCEAPPNAME"]; if (string.IsNullOrEmpty(appName)) { session.Log("Please set property CLICKONCEAPPNAME."); return(ActionResult.Failure); } try { var uninstallInfo = UninstallInfo.Find(appName); if (uninstallInfo == null) { session.Log("No uninstall information found for " + appName); return(ActionResult.NotExecuted); } session.Log("Uninstalling " + appName); var uninstaller = new Uninstaller(); uninstaller.Uninstall(uninstallInfo); } catch (Exception ex) { session.Log("ERROR in ClickOnceUninstaller custom action:\n {0}", ex.ToString()); return(ActionResult.Failure); } return(ActionResult.Success); }
public static ActionResult UninstallClickOnce(Session session) { session.Log("Begin to uninstall ClickOnce deployment"); var appName = session["CLICKONCEAPPNAME"]; if (string.IsNullOrEmpty(appName)) { session.Log("Please set property CLICKONCEAPPNAME."); return ActionResult.Failure; } try { var uninstallInfo = UninstallInfo.Find(appName); if (uninstallInfo == null) { session.Log("No uninstall information found for " + appName); return ActionResult.NotExecuted; } session.Log("Uninstalling " + appName); var uninstaller = new Uninstaller(); uninstaller.Uninstall(uninstallInfo); } catch (Exception ex) { session.Log("ERROR in ClickOnceUninstaller custom action:\n {0}", ex.ToString()); return ActionResult.Failure; } return ActionResult.Success; }