Package and deploy winform projects in

Source: Internet
Author: User

We often encounter the following problem: after we have developed a winform system, how can we make it run smoothly on an operating system without the. NET Framework installed? This involves packaging and deployment. by packaging and deploying the installation program, winform application software can be installed on the customer's operating system. On the other hand, you also need to consider forming an uninstallation program through packaging and deployment to uninstall the application software, so as to facilitate the customer's use.

 

1. Use the installation and packaging wizard

1. C # winform packaging Tool

When adding a project, select "New Project". In the displayed dialog box, select "Install and deploy project" for the project type ", select "installation project" or "Installation Wizard" for the template (we recommend that you select "Installation Wizard"), and enter the name of the installation project. The path is the directory where the solution is stored by default. After confirmation, the installation wizard dialog box is displayed. Click "Next". In the new dialog box, select "create installation program for Windows Applications" and click "Next ", in the new dialog box, select "project output group" (all are recommended). Follow the prompts to select an additional file and click "finish ".

2. Packaging Process

Return to the development environment. In resource manager, select the newly created installation and deployment project to view its details. In the application folder, select "main output ......" Right-click and choose "create main output ......" Create two shortcuts, rename them to the appropriate names, and drag the two shortcuts to the "user program menu" and "User desktop" respectively ". After completing the preceding operations, you can select the installation and deployment project in resource manager, right-click and select "regenerate" to complete the packaging process.

After packaging, go to the directory where the package file is stored. You can view the package file and click the EXE file for installation and testing. After the installation is complete, you can see the project startup entry in the desktop and program bar.

3. Other Instructions

(1) Check the installation directory and there may be source files. The solution is to package the "source files..." in the application folder ......" And "debugging ......" Delete two output items.

(2) In the packaging settings, you can set the desktop shortcut icon and the icon in the program bar.

(3) If the "Installation Wizard" is not selected, you must manually complete some content.

 

2. The installation error of a project packed in wizard mode may easily occur on a computer without environment, so I will introduce the manual packaging method.

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. Start production:

(1) Go to the project folder and double-click"Application folder"Right-click the blank area on the right and choose add> file to add the executable files and corresponding class libraries and components of your application. right-click your executable file, create a shortcut, and then cut or copy the shortcut to "user's 'apple' menu" and "User desktop" on the left.
After the installation and installation of the installer are complete, the program shortcut will be generated on "start-> All Programs" and "desktop.

 

(2) Right-click "application folder" on the left to open the Properties dialog box"Defaultlocation"Remove" [manufacturer] "from the path,
Otherwise, the default installation directory of the installation program will be "C:/programm file/your username/installation solution name ";

(3) open solution manager, right-click your solution name (Note: it is your installation project solution, not the original project), and select properties: on the open properties page, select"Required",On the System essentials page, select the following items. This is very important !!!!! 1 !!!!!After the installation is selected, the generated installation package contains the. netframework component. (this option is not selected by default)

 

(4) Well, 99% is finished, and then click "generate-> Generate solution". After the solution is generated, open the debug folder in the solution folder, the generated Installation File is displayed.
3. Add the "Uninstall" Function
The above article only introduces the simple method of generating and installing, but in vs. net2005, the function of directly generating and uninstalling programs is not available, so we have to use MSI to implement it,
(1)when setting your application project, upload an msiexec.exe file in the C:/Windows/system32 folder.

(2) After the program is added, change its name to "uninstall.exe" to make it more like an uninstallation program. Of course, this does not matter.
(3) create a shortcut for him and put it on the desktop or "start-program". I chose to put it in the Start Menu, 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, and then click the attribute tag. [Note: not the right-click attribute] The difference is great. Then you can see the productcode and open the shortcut Property dialog box that you created, enter "/X {productcode}" in the aguements attribute. Then, click "generate solution" to generate the installer with the uninstall function.

 

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.