C # program Packaging

Source: Internet
Author: User

C # There are two types of program packaging: one is the package method that comes with vs, and the other is the third-party packaging method. In vs2013, there is no package, installation, and deployment, only a third party is created.

The third-party packaging method is simple. After downloading Baidu InstallShield and installing it, you can run it directly, which is simple and easy to understand.

The next step is the next step. You don't have to pay attention to it. Let's talk about the next method.

Create a new installation and deployment solution and add all the package files to the referenced Program folder, if you want a shortcut Between the program menu and the user's desktop, create a shortcut and add it to the corresponding file.

Customize operations and add the programs you want to execute.

You can add corresponding effects on the user interface.

Select the properties of the referenced Program folder, modify the defaultlocation value, and remove the default installation path. Otherwise, it will be installed in C:/, which is not easy to find. This is also the description of Baidu.

Click Solution Properties, as shown below

Find the productcode, which is the identifier of the uninstalled product.

Get this value to the unmount attribute of the custom operation. The unmount file is the msiexec.exe file under Windows/system32/drivers. This unmount operation is not implemented by myself. It is installed with the windows8.1 system and is not very familiar with it.

The next step is the installation operation. This is to add a class library project. Add/targetdir = "[targetdir]"/attribute in customactiondata so that the class library project can get the PATH value.

1 using system; 2 using system. collections; 3 using system. collections. generic; 4 using system. componentmodel; 5 using system. configuration. install; 6 using system. LINQ; 7 using system. diagnostics; 8 9 10 namespace library111 {12 [runinstaller (true)] 13 public partial class installer1: system. configuration. install. installer14 {15 public installer1 () 16 {17 initializecomponent (); 18 // after all the installation programs run, run 19 this. afterinstall + = new installeventhandler (installer_afterinstall); 20 21} 22 private void installer_afterinstall (Object sender, installeventargs e) 23 {24 // This. context. parameters ["targetdir"] obtains the installation path in the Custom operation, you must enter/targetdir = "[targetdir]/" in customactiondata in the Custom operation to obtain 25 string Path = This. context. parameters ["targetdir"]; // obtain the installation path with the targetdir attribute 26 process. start (path + "\ .exe"); // run the executable program in the specified path 27} 28} 29}
View code

In this way, the specified executable file will be executed after the installation. The basic operations are messy, and the functions are complete.

You also need to learn and record...

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.