Visual Basic Concepts

Dependency Files

A dependency (.dep) file contains information about the run-time requirements of an application or component — for example, which files are needed, how they are to be registered, and where on the user's machine they should be installed. You can create .dep files for standard projects in all versions of Visual Basic. If you have the Professional or Enterprise edition of Visual Basic, you can create .dep files for ActiveX controls, ActiveX documents, and other ActiveX components.

The Package and Deployment Wizard uses .dep files when it packages your applications. It scans all available dependency information for the application to build a comprehensive list of information about the run-time files the application needs, then builds installation information from that list. For a standard package, the information from the .dep files is written to a Setup.lst file that is stored outside the packaged .cab file. For an Internet package, the .dep file information is written to an .inf file that is stored within the packaged .cab file.

When you package a component, you have the option of creating a .dep file to accompany it when it is deployed. You would do this if you have created a component you want to distribute with dependency information. It is recommended that you package and deploy your component before you package and deploy your dependency file, so that the packaging portion of the wizard knows the source location of the component that the dependency file references.

Types of Dependency Files

In Visual Basic, dependency information is stored in files generated by the Package and Deployment Wizard or created manually by you. There are two types of files that can contain dependency information:

  • Component .dep files — a .dep file lists files needed by a particular control or component. The Package and Deployment Wizard uses this file when it creates the setup program. In addition, the wizard can create this type of .dep file for you.

  • The VB6dep.ini file — a list of dependency files for the entire Visual Basic development environment.

When you run the Package and Deployment Wizard, it looks for dependency information in .dep files and in vb6dep.ini. If dependency information cannot be found for a component in either location, the wizard notifies you of the missing dependency information. You can ignore this omission or correct the problem by creating the appropriate dependency files.

Note   If you ignore the omission, your program may not function properly after installation. If, however, you are certain that a dependent file will already be loaded on the user's machine, you may ignore the warning and proceed.

Component Dependency Files

A *.*dep file lists all the files required by a particular component. When you purchase or use a component from a vendor, you receive a .dep file from them. For example, all of the ActiveX controls shipped with Visual Basic have a companion .dep file. These .dep files list all of the dependent files used by the control, plus version and registry information.

You should generate a .dep file for any component that you create in Visual Basic if that component may be used in another project. The information from the .dep file for each component in a project is combined to form the project's dependency information. If you do not create a .dep file for your component, the dependency information for any projects in which it is used may be incorrect.

The VB6dep.ini File

The VB6dep.ini file provides the Package and Deployment Wizard with an all-purpose list of dependencies and references used by Visual Basic. This list is created when you install Visual Basic and resides in the \Wizards\PDWizard subdirectory of the main Visual Basic directory.

In addition, the VB6dep.ini file contains a section listing files that should not be distributed with your packaged application. Files listed here may include design-time versions of files in your project, or files that cannot be redistributed by the Package and Deployment Wizard because they must be installed by another component.

Missing Dependency Information

The Package and Deployment Wizard will inform you if dependency information is missing for a component in your project. There are three ways you can add the necessary dependency information:

  • Edit the vb6dep.ini file to manually add an entry for a particular component.

  • Create a .dep file for the component with the Package and Deployment Wizard.

  • Contact the component's vendor and request a .dep file.