Go to: Use vs.net for installation and uninstallation.

Source: Internet
Author: User

InstallProgramIn vs.net, It is very convenient, especially in. net2005, and the interface is much more beautiful than 2003. However, there is still no built-in uninstallation program. If the installer is required to unmount it from the control panel, it is too hard. So I went online to find an example, I found some, so I described them one by one.

Method 1: Use the msiexec.exe file (usually in the \ winnt \ system32 directory ). Integrate the file into the installation file directory, select the project properties of the installation project, find the product code list, such as the productcode shortcut, set the name to uninstall, and then select Properties, enter/X space in the argumengs list, copy the copied productcode to this page, and then compile the installation file and try to install it, uninstalling the program is in the Start Menu. This is easy to use, but it is still inappropriate to copy an msiexec.exe file related to the operating system.
Method 2: 1. First deploy the program and write down the productcode value of the program, for example, 50026dc8-69dc-4b92-89cc-3d10ad4ca8c4
(Select the solution Resource Manager root directory, such as setup, and then view the property tag, not the right-click attribute)
2. Create a New winfrom Program
3. Delete the automatically generated form1.
4. Add classes and write them belowCode
Using system;

Namespace uninst
{
/// <Summary>
/// Summary of class1.
/// </Summary>
Public class uninstall
{
[Stathread]
Static void main (string [] ARGs)
{
String sysroot = system. environment. systemdirectory;
System. Diagnostics. process. Start (sysroot + "\ msiexec.exe", "/X {50026dc8-69dc-4b92-89cc-3d10ad4ca8c4}/QR ");
// {50026dc8-69dc-4b92-89cc-3d10ad4ca8c4} is the appeal's productcode
}
}
}
5. generate a new console Program
6. Add the new uninstall program to your installation package.

Method 3: 1.use vs.netto create a new console program uninst.exe file,
'Power by: landlordh
'For 2000, XP, 2003
Module uninstall
Sub main ()
Dim myprocess as process = New Process
If system. environment. osversion. tostring. indexof ("nt 5") then
Myprocess. Start ("msiexec", "/X {2b65d4a9-c146-4808-ab4b-321fb0779559}") "changed to your own productcode
End if
Myprocess. Close ()
End sub
End Module
2. Add the EXE file in the bin directory of the console program to the package file.
3.create an uninst.exe shortcut in the Program Group

It's much better to run around the street ...... Well, let's look at the comrades who need it. I hope Microsoft can help me uninstall the program while installing the program ...... :(. Hoho, people, always want to be lazy and get more things.

Procedure:

1) create a "installation and deployment project" --> "Installation Wizard"

2) choose Project> Add> file (in this example, create windows application .exe) --> open

3) Generally, dependencies are automatically added to "detected dependencies". If not, manually add them to 4)
Crystal_managed2003.msm (if there is a crystal Report)
Dotnetfxredist_x86.msm (. NET must be required)
... (If any other DLL is referenced)

4) manually add the file to be included: Project --> Add --> Merge Module (add your program file) (including dotnetframework and mdac27)
Located under: C: \ Program Files \ common files \ merge modules \

The specific functions are as follows:
(Managed component MSM processes distribution of all managed components, including windows form viewer, web form viewer, and all crystal decisions namespaces)
* Crystal_managed2003.msm,
Crystal_managed2003_chs.msm,

(For all other files required for running the report, the database accesses the MSM to process the distribution. These include database, export, and chart drivers .)
* Crystal_database_access2003.msm,
Crystal_database_access2003_chs.msm,

(Keycode MSM processes the installation of the crystal decisions key number. Note that the merging module is added; otherwise, the "mergemouduleproperties" attribute is not available)
* Crystal_regwiz2003.msm,

(It is the VC Runtime Library. It is estimated that it is crystal report or some programs involved are written in VC, so we need it !))
Vc_user_crt71_rtl_x86 _ ---. MSM,
Vc_user_stl71_rtl_x86 _ ---. MSM,

5) open solution --> right-click the properties of crystal_regwiz2003.msm, and fill in the "license key" in "mergemouduleproperties: aap5gksjwgde100ds (this is the password of the registration number used to generate the Crystal Report !)

6) generate a solution (or press Ctrl shift B directly)

Now the entire distribution program has been completed, and then double-click the installation program just made ......

-----------------------------------------------------------------------
Added the uninstall function during packaging:

Method 1:
1. Upload the msiexec.exe file to the package. (This file can be found in c: \ windows \ system32)
2. Upload the program file in the file system, press "right" on "msiexec.exe", select "Uninstall" to create a shortcut, and rename the shortcut to "Uninstall ".
3. Change the arguments of this shortcut to "/X {product ID}", and the value of product ID is the productcode validation value of the packaging destination.

Method 2: (recommended)
1.create a new console program uninst.exe file with vs.net,
'Power by: landlordh
'For 2000, XP, 2003
Module uninstall
Sub main ()
Dim myprocess as process = New Process
If system. environment. osversion. tostring. indexof ("nt 5") then
Myprocess. Start ("msiexec", "/X {2b65d4a9-c146-4808-ab4b-321fb0779559}") "changed to your own productcode
End if
Myprocess. Close ()
End sub
End Module
2. Add the EXE file in the bin directory of the console program to the package file.
3.create an uninst.exe shortcut in the Program Group

Uninstall the central application of vs.net --

I believe many people have installed the program. Currently, Installshield is the most comprehensive feature, but the InstallShield syntax is hard to learn. Relatively speaking, the installation and deployment of vs.net are short and concise, C # syntax is easy for C # developers to use. After some research on it, it is found that the function of installing and deploying a project in vs.net is also very useful, general program installation can be easily implemented. Of course, some defects are also found during the study. The main problem is that it is inconvenient to uninstall the software after installation, so you must go to the control panel. You can add an uninstall shortcut in the program as follows.

1. Create a C # windows from project to complete the project

2. Choose menu> File> Add project> new item> install and deploy project> Installation Wizard

Select the main output of the project above.

The property bar of the installation project displays "XXX deployment project properties". After the first addremoveprogramsicon property, "Browse" to your ICO icon, and then enter the author name in author, that is, your name. Other localization types are language attributes. Manufacturer and productname attributes are part of the default folder path set during installation. Set title to your application title name.

3. Right-click "installation project" and select the File System View.

Upload File (generally in the c: \ windows \ system directory, if it is another file, for example, win2kseries, select the msiexec.exe file under the Operating System Directory (generally in the \ winnt \ system32 directory ).

4. In the "user program menu" in the file system view, add a directory named project name,

In addition, add a shortcut in this directory to point to the main output of the project,

Upload another example to the added file "msiexec.exe", named "Uninstall ",

5. In the solution, select the installation project, and then open the property view to open the property Panel of the installation project. There is one in it:

Productcode {5284694c-24c1-4fcf-a705-d4b9a0081274}

Copy the following {5284694c-24c1-4fcf-a705-d4b9a0081274.

6. in the "Unload" shortcut attribute, there is an attribute column named arguments. In the attribute column, first fill in "/X" with a space, and then "Paste ", copy the property value of productcode to this point.

7. In the top menu bar of vs. net, "generate"-"generate XXXX" (XXXX is your project name)

8. Download Microsoft. NET Framework 1.1 from the Microsoft website http://www.microsoft.com/downloads/directly to the release package (dotnetfx.exe file), copy it to the directory generated by your release, and add your installation instructions and prompt files. In the installation instructions, the user is prompted to install dotnetfx.exe first, and then click your application to run it.

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.