You are on page 1of 14

Visual FoxPro 6.

0 Technical Articles

Microsoft Visual FoxPro 6.0 and Visual


Studio Installer Tutorial

Microsoft Corporation

December 1999

Summary: This article lists the basic steps involved in creating, configuring, and
building a Microsoft Windows Installer package (.msi) file with Microsoft Visual Studio
Installer. (14 printed pages)

Click to download the VFP_VSI.exe sample file.

Microsoft® Visual Studio® Installer is a graphical tool that simplifies the creation of
application setup programs for distribution to single user or enterprise-wide
desktops. Setups created with the Visual Studio Installer provide advanced
capabilities such as centralized distribution for maintenance and updates, application
self-repair, and powerful installation rollback facilities.

Visual Studio Installer setups are based on the new Microsoft Windows® installer
technology. The Windows installer reduces the total cost of ownership (TCO) for
customers by enabling them to efficiently install and configure applications. The
Windows installer is part of the Windows 2000 and Zero Administration Windows
(ZAW) efforts to reduce the overall cost of deploying, using, and managing desktop
computers.

For more information on the Visual Studio Installer, visit the Visual Studio Web site,
http://msdn.microsoft.com/vstudio/downloads/tools/vsi11/default.aspx. In addition,
you can read the Visual Studio Installer documentation.

Tutorial
This tutorial lists the basic steps involved in creating, configuring, and building a
Microsoft Windows Installer package (.msi) file with Microsoft Visual Studio Installer.
An .msi file is a storage file containing the instructions and data required to install an
application.

This tutorial will show how to author an .msi file to configure the installation of a
Visual FoxPro® application. It will also show how to launch the .msi file and install the
application.

To author and launch an .msi file with Visual Studio Installer, complete these tasks:

1. Open Visual Studio Installer and create an installer project as part of a Visual
Studio solution.
2. Add files to the installer project and configure file properties.
3. If desired, configure the project properties.
4. If desired, establish how to modify the target machine system registry when
your product is installed and configure registry properties.
5. If desired, establish how the target machine operating system will handle your
installed document types, MIME types, COM objects, and type libraries, and
configure properties for each of these objects.
6. If desired, control and customize the installation dialogs presented when your
users run the installer package file to install, repair, or uninstall your product.
7. Add merge modules to the project.
8. Build the installer package file.
9. Test the installer package file.
10. Distribute the application.

Create an Application to Distribute


For the purposes of this demo, the Visual FoxPro Application Wizard was used to
create an application called VFPVSIDemo. The application was then built into an EXE,
called VFPVSIDemo.exe.

The data used by the application is in a folder named Data. This folder is a subfolder
of the main application folder.

Step 1: Open Visual Studio Installer


1. Click Start, and select Programs.
2. From the Programs menu, select Microsoft Visual Studio 6.0, and then
select Microsoft Visual Studio 6.0 Enterprise Tools.
3. From the Microsoft Visual Studio 6.0 Enterprise Tools menu, click Visual
Studio Installer.
4. The Microsoft Development Environment launches, and you can create a new
installer project from the New tab in the New Project dialog box.
5. Create an empty installer project by highlighting the Empty Installer icon.
6. Enter VFPVSIDemo as the name of the project.

Make a note of the directory in the Location textbox. This is where the
application installer file you create will be located. You can change the
location for your project if you like.

7. Choose Open.
Figure 1. Creating a new Visual Studio Installer project

Visual Studio Installer creates your installer project. The Project Explorer displays
your installer project hierarchy. You can expand the Target Machine node to start
setting up the configuration of your installed product on the target machine.

Figure 2. Empty Visual Studio Installer project

For more detailed information about creating installer projects, see Creating and
Opening Installer Projects.

Step 2a: Add Application Files to the Installer


Project
The File System editor in Visual Studio Installer gives you a way to configure your
application files on the target machine while you add them to the installer project.

1. In the Project Explorer, expand the Target Machine node.


2. Double-click File System in the Target Machine node.
3. In the File System editor, right-click Application Folder.
4. Select Add File(s) from the context menu.
5. In the Browse for Files dialog box, navigate to the directory that contains
the application. Select the files you want to add. In this case, choose the file
VFPVSIDemo.exe.
6. Click Open.

The File System editor displays the file(s) you added in the folder you
selected. The files are also listed in the installer project Files node in the
Project Explorer.

Figure 3. Files added to the installer project

7. In the File System editor, select User’s Start Menu.


8. In the Name column, right-click and select Create Shortcut.
9. In the Shortcut Properties dialog, select VFPVSIDemo.exe and choose
OK.
10. Right-click the shortcut and choose Rename. Rename the shortcut
VFPVSIDemo.

This places a shortcut to the file VFPVSIDemo.exe on the user’s Start menu.

See the following topics for more detailed information about working with files in an
installer project:

For information about: See:


The Visual Studio Installer File System File System Editor
editor

Adding files to an installer project Adding Files to an Installer Project

Adding, moving, or deleting different Managing Components, Files, and


kinds of files in an installer project and Folders in an Installer Project
managing the file structure of installer
components

Setting file properties File Properties

Step 2b: Add Data Files to the Installer


Project
In the previous step, you added the application files to the installer project. In this
step, you will add the data files, which reside in a different directory.

1. In the File System editor, right-click Application Folder.


2. Select AddFolder from the context menu.
3. Change the name of the new folder to Data.
4. In the File System editor, right-click Data.
5. Select Add File(s) from the context menu.
6. In the Browse for Files dialog box, navigate to the directory that contains
the application. Select the files you want to add. In this case, choose each of
the data files.
7. Click Open.

Figure 4. Data files added to the installer project

Step 3: (Optional) Configure Project


Properties
1. Select the VFPVSIDemo project in the Project Explorer window.
2. At the end of the Project menu, select the VFPVSIDemoProperties option.

The Project Properties dialog box appears. You can view or change the project
properties in the Project Properties dialog box.

For information about the different project properties and how to modify them, see
Project Properties Dialog Box.

Step 4: (Optional) Modify the Target Machine


System Registry
With the Visual Studio Installer Registry editor, you can specify registry values and
keys in the target machine system.

1. In the Project Explorer, expand the Target Machine node under your
installer project.
2. Double-click Registry in the Target Machine node.
The Registry editor appears.

See the following topics for more detailed information about manipulating the target
machine registry:

For information about: See:

Adding and deleting registry keys and Manipulating the Target Machine
values, as well as setting registry values Registry

The Visual Studio Installer Registry editor Registry Editor

Setting properties for registry entries Registry Properties

Step 5: (Optional) Establish Document and


MIME Type and COM Object Associations
With the Visual Studio Installer Associations editor, you can specify how the target
machine operating system will install and register your document types, MIME types,
COM objects, and type libraries.

1. In the Project Explorer, expand the Target Machine node under your
installer project.
2. Double-click Associations in the Target Machine node.

The Associations editor appears.


See the following topics for more detailed information about working in the
Associations editor:

For information about: See:

Working with document types, Setting File, MIME, COM Object, and
extensions, verbs, MIME types, COM Type Library Associations
objects, and type libraries

The Visual Studio Installer Associations Associations Editor


editor

Configuring properties for document Visual Studio Installer Object Properties


types, file extensions, verbs, COM
objects, and type libraries

Step 6: (Optional) Customize the Installation


Run-Time Dialog Boxes
With the Visual Studio Installer User Interface editor, you can customize the
installation run-time display. Specifically, you can specify and customize dialogs that
are displayed during the installation process.

1. Open the solution containing your Visual Studio Installer project.


2. In the Project Explorer, expand the Target Machine node under your
installer project.
3. Double-click User Interface in the Target Machine node.

The User Interface editor appears.

See the following topics for more detailed information about installation user
interface dialogs:

For information about: See:

Available user interface dialogs Installation User Interface Dialogs

The Visual Studio Installer User Interface User Interface Editor


editor

Adding dialogs to the installer project Adding Installation Dialogs

Deleting dialogs from the installer project Deleting Installation Dialogs


Customizing available dialogs Customizing Installation Dialogs

Working with dialog properties User Interface Dialog Properties

Step 7: Add Merge Modules


A merge module (.msm file) is a single package that includes all files, resources,
registry entries, and setup logic to install a shared component. Visual FoxPro
applications should always include the following merge modules:

• VFP6RUN.MSM
• MSVCRT.MSM
• OLEAUT32.MSM

The files MSVCRT.MSM and OLEAUT32.MSM ship with Visual Studio Installer. You can
find these and other merge modules in the directory c:\Program Files\Microsoft Visual
Studio\Common\Tools\VSInst\BuildRes.

Note The files contained in MSVCRT.MSM and OLEAUT32.MSM are automatically


installed by Windows 2000. Therefore you do not need to add these merge modules
to the Installer project if you know the application will only be installed on Windows
2000.

Save the file VFP6RUN.MSM (available from the sample download at the top of this
article) to the directory with the other merge modules.

1. Choose Add Merge Module(s) from the Project menu.


2. In the Browse for Merge Module dialog highlight the file VFP6RUN.MSM and
choose Open.

The VFP6RUN.MSM merge module installs and properly registers the Visual FoxPro
6.0 run-time libraries. Refer to Using Microsoft Visual Studio Installer for Distributing
Visual FoxPro 6.0 Applications for a reference guide to other available merge
modules that ship with Visual Studio Installer.

Step 8: Build an Installer Package (.msi) File


After you configure all elements of an application’s installation in your installer
project, you must build the project into an installer package (.msi) file. You can then
distribute the .msi file to users who want to install your application.

1. In the Project Explorer, select your installer project.


2. Make sure the Build type project property (on the Build tab of the Project
Properties dialog box) is set to either:
• Installer

—or—

• Installer with Windows Installer Loader

Note For information about these options, see the Build Tab (Project
Properties Dialog Box) topic.

3. With the installer project selected in the Project Explorer, select Build from
the Build menu.

You should see the message Solution Update Succeeded in the Status Bar if the
project built successfully. If errors occurred, you should see them in the Task List.

For more information, see Building an Installer Package (.msi) File.

Step 9: Test the Installer Package (.msi) File


For development and debugging purposes, the best way to launch your installer
package (.msi) file is from within the Microsoft development environment.

1. In the Project Explorer window, right-click the VFPVSIDemo project.


2. Select Launch Installer from the context menu.
3. Select Next on the opening screen of the VFPVSIDemo Setup Wizard.
Figure 5. Opening screen of VFPVSIDemo Setup Wizard

4. In the Select Installation Folder step, you can choose to install the
application in the default directory or change the directory.
Figure 6. Select Installation Folder step in VFPVSIDemo Setup Wizard

5. In the Confirm Installation step, select Next to begin the installation.


6. When the installation is complete, select Close to exit the VFPVSIDemo
Setup Wizard.
7. Choose VFPVSIDemo from the Start menu to launch the application.

For more information about these Windows installer requirements and launching an
installer package file, see Launching an Installer Package File.

Note If you set the Build Type as Installer with Windows Installer Loader in
the previous step, you should run SETUP.EXE file to test your setup.

Run the application to confirm the installation succeeded. If you accepted the
defaults, the application is installed in the directory C:\Program Files\VFPVSIDemo
and the data is installed in C:\Program Files\VFPVSIDemo\Data.

Step 10: Distribute the Application


Your application is now ready for distribution. The file VFPVSIDEMO.MSI contains the
application and the files in the VFP6RUN.MSM merge module.

1. Locate the VFPVSIDemo.msi file. If you accepted the default Location when
you created the project, it will be in a directory such as Visual Studio
Projects\VFPVSIDemo\Output\DISK_1\.
2. To launch the installer, double-click the file VFPVSIDemo.msi.
3. Open the VFPVSIDemo Setup Wizard. Choose RepairVFPVSIDemo to
reinstall the application. Choose RemoveVFPVSIDemo to uninstall the
application. Then choose Finish.

Figure 7. Repair or Remove in VFPVSIDemo Setup Wizard

You might also like