Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#1 Uninstall shortcut

Unstable (example)
closed-accepted
nobody
None
5
2009-01-27
2009-01-21
exavolt
No

MainFrame.cs class MainFrame

private void CreateUninstallShortcut()
{
Guid uninstallShortcutGuid = Guid.NewGuid();

XmlElement feature_node = doc.CreateElement("Feature");
product.AppendChild(feature_node);
feature_node.SetAttribute("Id", "UninstallShortcut");
feature_node.SetAttribute("Title", "Create Uninstall Shortcut");
feature_node.SetAttribute("Level", "1");
feature_node.SetAttribute("Description", "Create uninstall shortcut in Start Menu");
feature_node.SetAttribute("InstallDefault", "local");

// Make the reference from Feature
XmlElement component_ref = doc.CreateElement("ComponentRef");
component_ref.SetAttribute("Id", "UninstallShortcutComponent");
feature_node.AppendChild(component_ref);

XmlElement comp = doc.CreateElement("Component");
my_program_menu.AppendChild(comp);
comp.SetAttribute("Id", "UninstallShortcutComponent");
comp.SetAttribute("Guid", uninstallShortcutGuid.ToString());

XmlElement regnode = doc.CreateElement("RegistryValue");
comp.AppendChild(regnode);
regnode.SetAttribute("Root", "HKCU");
regnode.SetAttribute("Key", @"SOFTWARE\"
+ CurrentProject.projectOrganization
+ @"\" + CurrentProject.projectName
+ @"\Uninstall");
regnode.SetAttribute("Type", "string");
regnode.SetAttribute("KeyPath", "yes");
regnode.SetAttribute("Value", "");

XmlElement shortcut = doc.CreateElement("Shortcut");
comp.AppendChild(shortcut);
shortcut.SetAttribute("Id", "UninstallProduct");
shortcut.SetAttribute("Name", "Uninstall " + currentProject.projectName);
shortcut.SetAttribute("Target", "[System64Folder]msiexec.exe");
shortcut.SetAttribute("Arguments", "/X{" + currentProject.projectUuid + "}");
shortcut.SetAttribute("Directory", "ProgramMenuDir");
shortcut.SetAttribute("Description", "Uninstall " + currentProject.projectName);

XmlElement remdir = doc.CreateElement("RemoveFolder");
comp.AppendChild(remdir);
remdir.SetAttribute("Id", "RemoveShortcutFolder");
remdir.SetAttribute("On", "uninstall");
}

Discussion

  • Jarle Aase
    Jarle Aase
    2009-01-27

    Thanks!

    I'll add the feeature to the next version.
    Jarle

     
  • Jarle Aase
    Jarle Aase
    2009-01-27

    • status: open --> closed-accepted