Visual Basic Concepts

Application Packaging with the Wizard

See Also

Application packaging is the act of creating a package that can install your application onto the user's computer. A package consists of the .cab file or files that contain your compressed project files and any other necessary files the user needs to install and run your application. These files may include setup programs, secondary .cab files, or other needed files. The additional files vary based on the type of package you create.

You can create two kinds of packages — standard packages or Internet packages. If you plan to distribute on disk, floppy, or via a network share, you should create a standard package for your application. If you plan to distribute via an intranet or Internet site, you should create an Internet package.

In most cases, you will package your applications using the Package and Deployment Wizard, which is provided with Visual Basic. You can package applications manually, but the wizard provides valuable shortcuts and automates some of the tasks you would have to perform yourself in a manual packaging session.

Note   In addition, you can use the Setup Toolkit and the Package and Deployment Wizard together. You can modify the Setup Toolkit project to customize your setup programs and add features that that Package and Deployment Wizard does not provide, then use the wizard to package and deploy the application.

In addition to creating standard and Internet packages, you can also use the packaging portion of the Package and Deployment Wizard to create dependency files. Dependency files list the run-time components that must be distributed with your application's project files.

Important   Any time you create a package, you should be sure that the version number for your project has been set on the Make tab of the Project Properties dialog box. This is especially important if you are distributing a new version of an existing application: Without the appropriate change in version numbers, the end user's computer may determine that critical files do not need to be updated.

After creating a package using the wizard, you can quickly recreate its cab files using a batch file that the wizard generates and places in the package folder directory. If you do this, you must make manual edits to the setup.lst file. See "Recreating CAB Files from a Batch" later in this section for instructions on how to edit the setup.lst file in this scenario.

For More Information   For a more detailed explanation of standard packages and their contents, see "Standard Packages" later in this chapter. See "Internet Packages" for more information about Internet packages and their contents. See "Using the Setup Toolkit Project with the Package and Deployment Wizard" later in this chapter for more information on using the two tools together to create customized setup programs. See "Dependency Files" for an explanation of the contents of a dependency file.

Files You Are Allowed to Distribute

You can freely distribute any application or component that you create with Visual Basic. In addition to an executable (.exe) file, your application might require other files, such as DLLs, ActiveX controls (.ocx files), or bitmaps (.bmp files).

You can legally distribute sample application files and any files that were originally copied to the \Icons subdirectory of the \Visual Studio\Common\Graphics directory when you first installed Visual Basic on your system. Microsoft makes no warranty, express or implied, regarding the merchantability or fitness of these applications, nor does Microsoft assume any obligation or liability for their use.

Note   The \Graphics directory is only installed if you choose a Custom setup when you install Visual Basic, and then choose to install Graphics.

If you have purchased the Professional or Enterprise Edition of Visual Basic, you can also distribute any files originally copied to the \Visual Studio\Common\Graphics and \Program Files\Common Files\ODBC subdirectories .

Note   You may also be able to distribute other ActiveX controls, .exe files, and DLLs that you have purchased. Consult the manufacturer's license agreement for each of the files you plan to distribute to determine whether you have the right to distribute the file with your application.

Overall Steps in the Packaging Process

Regardless of the type of package you create or the tool you use to create it, there are certain steps that must be taken.

Note   The Package and Deployment Wizard performs many of these steps for you automatically.

  1. Determine the type of package you want to create. You can create a standard package for Windows-based programs that will be distributed on disk, on CD, or over a network; or you can create an Internet package for programs that will be distributed on the Web. You can also choose to create only a dependency file.

  2. Determine the files you need to distribute. The wizard must determine the project files and dependent files for your application before it can create the package. Project files are the files included in the project itself — for example, the .vbp file and its contents. Dependent files are run-time files or components your application requires to run. Dependency information is stored in the vb6dep.ini file, or in various .dep files corresponding to the components in your project.

  3. Determine where to install files on the user's machine. Program and setup files are usually installed into a subdirectory of the Program Files directory, while system and dependent files are usually installed into the \Windows\System or \Winnt\System32 directory. Your setup program must take this into account and determine where to install each file.

  4. Create your package. The wizard creates the package and the setup program (setup1.exe) for it, referencing all necessary files. The end result of this step is one or more .cab files and any necessary setup files.

  5. Deploy your package. The deployment process involves creating your distribution media and copying all necessary files to the location from which users can access it. For information on deployment, see "Application Deployment with the Wizard" later in this chapter.

For More Information   For a full list of common run-time, setup, and dependency files, see "Files You Need to Distribute" later in this chapter. See "Dependency Files" later in this chapter for more information on creating a .dep file.