Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
(ebook) Visual Studio .NET Mastering Visual Basic.pdf
Скачиваний:
120
Добавлен:
17.08.2013
Размер:
15.38 Mб
Скачать

DISTRIBUTING AN APPLICATION

75

you’re ready to build an installer for a large application, you will have to consult the documentation extensively.

Custom Actions and System Requirements Buttons

The last two buttons on the Properties window allow you to specify custom actions and requirements for the target machine. For example, you may specify that the application be installed only on systems on which a specific component has already been installed. You can ignore these buttons for a simple installation project.

Finishing the Windows Installer

OK, we’re almost there. Select Build Build Solution, and VB will create the installation program. First, it will create a new project folder, the SimpleCalculators folder. This is where the Setup project’s files will be stored and where the executable file of the installation program will be created. The process of building the executables and creating the Setup program will take several minutes. The output of the build process is the SimpleCalculators.msi file. This is an executable file (known as Windows Installer Package), and it will be created in the \SimpleCalculators\Release folder. Its size will be approximately 15 MB. If you’re wondering what’s in this file, take a look at the Output window of the IDE and you will see a large list of components added to the package.

Running the Windows Installer

Now you’re ready to install the Calculators project to your computer. If you have access to another computer that doesn’t have Visual Studio installed, you should copy the SimpleCalculators.msi file there and install the application there. The components required for your application to run properly are already installed on the development machine, and you can test the Setup project better on another machine.

Go to the folder \SimpleCalculators\Release and double-click the icon of the Windows Installer Package (or the folder to which you have copied this file on another machine). The MSI file is represented by the typical installation icon (a computer and a CD). The following figures show the installation steps. Please notice where the captions you specified in the Setup project’s properties appear in the screens of the installation wizard. Consult these figures as you build a Setup application to make sure the proper messages are displayed during the installation on the target computer.

1. This dialog appears while the Windows installer starts.

2.The welcome screen of the wizard that will guide the user through the installation procedure. The messages on this screen are the properties CopyrightWarning and WelcomeText of the Welcome dialog box in the User Interface Editor.

Copyright ©2002 SYBEX, Inc., Alameda, CA

www.sybex.com

76Chapter 2 VISUAL BASIC PROJECTS

3.This screen lets the user change the default path of the application to be installed. Notice how the default path is formed. You can control the default installation path by setting the appropriate properties of the Setup project. The installer will create a folder, under the Pro-

gram Files folder, named after the Manufacturer and ProductName properties of the Setup project.

4.This screen asks the user to confirm the installation—which can be cancelled later as well.

5.The application is being installed, and this screen displays a progress indicator. The user can terminate the installation by clicking the Cancel button.

6.The last screen of the installer confirms the successful installation of the application. Click Close to end the program. If there was a problem installing the application, a description of the problem will be displayed on this last screen. In this case, all the components installed in the process will be automatically removed as well.

Copyright ©2002 SYBEX, Inc., Alameda, CA

www.sybex.com

DISTRIBUTING AN APPLICATION

77

Verifying the Installation

You already know the kind of changes made to your system by an installation program. If you open the Programs menu (Start Programs), you will see that a new item was added, the Demo Calculators item. If you select it with the mouse, a submenu will open, as shown in Figure 2.21. You can select any of the three commands (Calculators, Calculator, or LoanCalculator) to start the corresponding application.

Tip All three items in the Demo Calculators submenu have the default application icon. You should change the default icons of your applications for a more professional look.

Figure 2.21

The new items added to the Programs menu by the Windows installer

The Windows installer has created and installed a program for uninstalling the application from the target computer. Open Control Panel and double-click the Add/Remove Programs icon. The dialog box that appears contains an item for each program you can remove from your computer. The newly installed application is the item The EasyCalc Project, as shown in Figure 2.22. Click its Remove button to uninstall the application or the Change button to repair an existing installation.

Copyright ©2002 SYBEX, Inc., Alameda, CA

www.sybex.com