C # how to package and uninstall a Windows form program

Source: Internet
Author: User

1. Create an installation and deployment project

Open VS, click "Create Project", select "other project type"> "installation and deployment"> "Installation Wizard" (the same is true for the installation project), and click "OK.

2 Installation Wizard

Open the Installation Wizard, click Next, or click Finish.

3. Start production.

After the installation wizard is complete, you can enter the project folder:

Double-click "application folder", right-click the blank area on the right, and choose "add"> "file" to add executable files and corresponding class libraries and components of your application. Right-click your file, create a shortcut, and copy or cut the shortcut to "user program menu" and "User desktop" on the left. After the installation is complete, a shortcut is generated on "start-> All Programs" and "desktop. You can also create a shortcut in the corresponding directory of "user program menu" and "User desktop" and locate your file.

Right-click "application folder" on the left to open the Properties dialog box: Remove "[Manufacturer]" from the "DefaultLocation" path in the property, otherwise, the default installation directory of the installation Program will be "C: Program Files your USERNAME \ installation solution name ";

Open solution manager, right-click your solution name, and select Properties: On the open properties page, select "system essential". On the system essential page that appears, select the following option in "specify the location of required system components": download the required system components from the same location as my application. After the installation is selected, the. NetFramework component is included in the generated installation package. Now, 99% is complete, and then click "generate-> Generate solution". Ha, generation successful!

4. Production completed

Now open the Debug folder under the solution folder and you will be able to see the generated Installation File.

5. Add the "Uninstall" Function

The preceding section only describes how to generate and install a program. However, the uninstall program function is not directly generated in VS2005. Therefore, we have to use msi to implement the function. The procedure is as follows:

When setting your application program objectives, upload an msiexec.exe file in the c: windowssystem32 folder. After adding the file, change the name to "Uninstall.exe" to make it more like an uninstall program. Of course, this does not matter, it can be changed.

Create a shortcut and place it in "start-program". Next, we need to find the ProductCode of the deployment project. Click the project name with the left mouse button. Remember to click it with the left mouse button, click the attribute tag. Note: This is not a right-click attribute. The difference is great. Then you can see the ProductCode.

Open the shortcut Property dialog box that you created, and enter "/x {ProductCode}" in the Aguements property, click "generate solution" to generate the installer with the uninstall function.

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.