Schematic installation program Packager using VS

Source: Internet
Author: User

background

This period of time has been doing the client program packaging procedures, encountered various pits. Because there was no experience in this area, after all kinds of tossing and racking, Dickens is finally finished.

Although there is not much technical content, but because it is very cumbersome, so the record here.

for space reasons, first stage is introduced: direct use VS comes with the installation Project Packager.

later on: Customize the Installation Interface (not for Windows Default style) and use the NSIS script to create a wrapper.

1.   set up the installation Project project1.1.Create a project

First in VS , open the project you're going to pack. In my case, my project is called System.

Right-click Add - New Project , Solution--- Popup dialog box.

we might as well name the new installation project named Setupsystem.

1.2.Set installation project Properties

Select the Setup Project project and set some parameters in its property bar.

Author --Developer

manufacturer-- software manufacturer

Both of these defaults are attributed to Microsoft Corporation.

ProductName --Product name

Version --release version. After you change the version number, theUpgradeCode will change as well.

1.3.Set the default installation path

Check the application Folder to see its property bar.

as shown, the default installation path is: ProgramFiles Path + generate manufacturer name + product name.

For example, if you follow my previous step (2) to set the default installation path name will be:C:\Program Files (x86) \zp\system\.

If you do not want to display the manufacturer name, you can [Manufacturer] This parameter is removed.

2.   Add installation files

( 1 ) Add Project Output

There are three paths in the File system column: The application Folder , the user's program menu , User Desktop .

Application Folder and the installation directory, the user's " program " menu and the user's desktop must not explain more.

First double-click the Application folder and add the contents of the installation directory here.

Open the context menu and click Add project output , popup Add Project output group menu.

Check the main output and click OK. VS Auto-importer exe files and program dependent DLL files.

( 2 ) to add a resource file

Of course, you may also need to add a resource file.

There are two ways of doing this:

one is, open the context menu and click Add , select the resources you want to add, such as files, folders, and so on. It is important to keep the directory structure consistent with the structure of the installation root directory you expect.

There is one more simple way to copy, drag and drop the resource files or folders you want to add to the application folder.

3.   Add Uninstall program

add one more msiexec.exe go in This file is in c:\windows\system32 folder.

m Siexec.exe This execution file is used to install Windows Installer installation Package ( MSI format files).

4.   Create a shortcut4.1.Add Shortcut

Right-click the executable file and msiexec.exe to add a shortcut to them.

In the Properties bar of the shortcut, you can Icon in the icon item for which an ico format is set .

4.2.Setmsiexecparameters for shortcut

for msiexec.exe shortcuts, you need to set some parameters to properly uninstall the installed program.

The steps are as follows:

Select the installation project, copy it in the property bar the value of the ProductCode item.

then open the Properties dialog box for the shortcut you created ,

in the Enter "/x {ProductCode}" in the Aguements property ,

After you install the program, open the registry to view the uninstall information.

Take my machine (the four-bit operating system) as an example,

hkey_local_machine\software\wow6432node\microsoft\windows\currentversion\uninstall\{ Product Code You can see the information.

Note : If it is a three-digit, it should be hkey_local_machine\software\ microsoft\windows\currentversion\uninstall\{ Product Code }

4.3.add a shortcut to the user's Programs menu and user's desktop

copies the shortcuts for executing files to the user's " program " Menu and user Desktops .

Copy the uninstaller shortcut to the user's " program " Menu .

5.   Adding dependencies

Select the installation Project project, open the context menu, click Properties , Pop-up Properties dialog box.

Click Prerequisites to bring up the Prerequisites dialog box.

Output File name The path to the output file can be set in the key, and the installer will output to this path at the end.

Select the prerequisites you want to add, click OK

Note that there are three ways to install prerequisites:

1. The installation will download the corresponding components from the supplier's official website.

2. Package The components directly into the installer file, eliminating the download effort.

3. Specify a path to download the corresponding component.

Finally, check the installation project, open the context menu, click Build, will automatically generate the installation program.

The generated setup files are as follows

6.   Add Registry

(1) in the Solution Explorer window, select the Setup project, right-click, choose the View / Registry option in the popup dialog box,

(2) in the "Registry" tab, you can hkry_current_user/software or hkry_current_machine/ Software Add a key value, and of course the node name can also be renamed.

Click the right mouse button and select the new /String value option in the dialog box that pops up .

I have set a key named Key1 , with the value "Hello World"

(4) Select the added registry key value, right-click, select the "Properties Window" option, pop Up the "Properties" window, where the value of the registry key can be modified.

By following the steps above, you can add a registry key to the Setup program. After the program is successfully installed, look at the registry and you can see the key values that we write.

7.   Add, modify Installation page

VS supports adding and modifying the installation page for the Setup program. But I'm trying to find that it's not flexible enough. Only the default style style can be used. Here, I have a general introduction.

7.1.Open User Interface View

Select the Setup project, open the right-click menu, View - user interface .

7.2.Add dialog box

in the user interface view, select Start , open the right-click menu, tap Add dialog box .

Select the dialog box you want to add, such as:

Select a dialog box and adjust the order in which it will be executed. Such as:

As for the property settings of each dialog box, no longer repeat here, interested friends can toss their own.

References

Http://blog.sina.com.cn/s/blog_473b385101019ufr.html

Http://jingyan.baidu.com/article/e8cdb32b871eaa37052badd1.html

Schematic installation program Packager using VS

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.