C #. Net uninstall the application

Source: Internet
Author: User

Method 1:

In the packaging project, locate the "msiexec.exe" file (generally found in c: windowssystem32 (in the system directory ).

In the file system view, select the application file, right-click msiexec.exe and choose "create shortcut", and rename the shortcut to "uninst ".

Change the shortcut Argmuments to "/x {product ID}", and the value of the product ID is the ProductCode attribute value of the package project.

Method 2:

Enter the installation package, and write down the ProudctCode (select the solution Resource Management root directory such as Setup1, and then view the property tag, not the right-click attribute ).

Use Vs. Net to create a new console program uninst.exe file.

The Code is as follows:

Using System;
Namespace uninst
{
/// <Summary>
/// Summary of Class1.
/// </Summary>
Class UnInstall
{
/// <Summary>
/// Main entry point of the application.
/// </Summary>
[STAThread]
Static void Main (string [] args)
{
String sysroot = System. Environment. SystemDirectory;
System. Diagnostics. Process. Start (sysroot + "\ msiexec.exe", "/x {850FED90-20D0-4EBA-BEDB-3D9DBA25F6EC}/qr ");
}
}
}

After compilation, add the generated uninst.exe file to the installation package and regenerate the installation project.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.