Microsoft KB Archive/830761

= Best practices for deploying Visual Basic 6.0 applications =

Article ID: 830761

Article Last Modified on 5/18/2007

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Professional Edition

-





SUMMARY
''This article discusses how to prepare to deploy a Microsoft Visual Basic 6.0 application.

To prepare a Visual Basic 6.0 application for deployment, make sure that you do the following:''

 

Plan ahead and budget time to package and to test the application.

 

Package the application on a &quot;clean&quot; computer.

 

Use the same software configuration on both the development computer and the packaging computer.

 

Identify and minimize application dependencies.

 

Prepare the Package and Deployment Wizard Redist folder.



To troubleshoot a deployed Visual Basic 6.0 application, use the following methods:

 

Use the tools for troubleshooting deployment issues.

</li> 

Review common deployment issues.

</li></ul>

To troubleshoot a deployed Visual Basic 6.0 application that was installed by using an alternative installer technology, use the following methods:

 

Redistribute minimum dependencies.

</li> 

Build a Setup package by using the Package and Deployment Wizard.

</li></ul>

<div class="summary_section">

INTRODUCTION
Before you deploy a Visual Basic 6.0 application, you must plan how you want to build and to deploy the package that installs the application. You must also decide what files you want to include in the package. Additionally, you must test the package before you deploy it to make sure that the installed application works as expected. This article discusses issues that you must consider and tools that you can use to deploy your application.

Prepare to deploy your Visual Basic 6.0 application
When you are preparing to deploy a Visual Basic 6.0 application, consider how much time you will require to package and to test the application. Include time to prepare the computers that you will use, time to identify and to minimize application dependencies, and time to prepare the Redist folder that contains the correct versions of files that you want to redistribute with the application.

Plan ahead and budget time to package and to test your application
Many developers spend lots of time and effort to develop an application, and then they spend little time or no time to package and to test the application on other computers. This is a common mistake. It is best to budget time into your development schedule for packaging and for testing your application. Consider which operating system versions and which configurations you will support for your application, and budget time for testing the application on those configurations.

The Visual Basic 6.0 Package and Deployment Wizard was designed to deploy applications to Microsoft Windows 95, Windows 98, and Microsoft Windows NT 4.0 or later. However, for obsolete operating systems, such as Windows 95, Microsoft provides support for deploying Visual Basic 6.0 applications on a &quot;best effort&quot; basis after the problem is identified as being specific to the operating system.

For information about the life cycle of a specific version of Internet and MSN, visit the following Microsoft Web site:

http://support.microsoft.com/gp/lifeselectintmsn

Note Microsoft does not provide support for deploying or for running Visual Basic 6.0 applications on Windows NT 4.0 Terminal Server.

For more information about how to run Visual Basic 6.0 applications on Windows NT 4.0 Terminal Server, click the following article number to view the article in the Microsoft Knowledge Base:

196201 Visual Basic is not supported on Terminal Server 4.0

Prepare the development computer and the packaging computer
When you are preparing to develop and to package a Visual Basic 6.0 application, consider the following best practices:  Package on a &quot;clean&quot; computer. A &quot;clean&quot; computer is a computer that has only the required software installed to develop and to package a Visual Basic application. At a minimum, that software includes only the operating system and Visual Studio 6.0.

If your application requires other components, you must also install them. However, it is a good idea to avoid installing anything that is not required, such as beta software, or anything that might change the redistributable files that your application package requires.</li> Install the latest operating system and the latest Visual Studio 6.0 service pack. Make sure that you have installed the latest service packs and that you have applied the latest updates for the operating system on both the development computer and the packaging computer. To apply the latest updates for your computer, visit the following Microsoft Windows Update Web site:

http://windowsupdate.microsoft.com

Additionally, make sure that you have installed the latest Visual Studio 6.0 service pack on both the development computer and the packaging computer. To obtain the latest Visual Studio 6.0 service pack, visit the following Microsoft Developer Network (MSDN) Web site:

http://msdn2.microsoft.com/en-us/vstudio/aa718359.aspx

</li> Make sure that the development computer and the packaging computer have the same software. If you are packaging the application on a computer other than the development computer, make sure that both computers have the same software configuration. For example, make sure that both computers:  Are running the same operating system version.</li> Have Visual Studio 6.0 installed.</li> Have the same service packs installed for the operating system and for Visual Basic 6.0.</li> Use the same versions of external components that your application uses, such as Microsoft Data Access Components (MDAC).</li></ul>

Additionally, if you are packaging the application on a computer other than the development computer, make sure that the compiled versions of your binaries work correctly on the packaging computer. If you receive an error message when you run your application on the packaging computer, the error message may indicate that one of the application's dependencies is missing or has a versioning problem.</li></ul>

Identify and minimize application dependencies
Missing or mismatched versions of application dependencies are the most common cause of problems that developers experience when they distribute Visual Basic 6.0 applications. Therefore, it is extremely important that you identify exactly what dependencies your application requires, and their versions. This way, you can make sure that you are redistributing the correct dependencies with your application.

Generally, the Package and Deployment Wizard does a good job of redistributing the correct dependencies for your application. However, to minimize problems, minimize the dependencies that your application requires.

The main dependencies in a Visual Basic 6.0 application are component references and COM library references. Component references include ActiveX controls or designers that are located in an external .ocx file or in an external .dll file. When you select an ActiveX control in the Components dialog box, Visual Basic puts an icon for the control in your control toolbox and then adds a reference to the external library in the Visual Basic project.

If a component requires a supporting DLL, Visual Basic automatically adds the DLL as a library reference in the References dialog box. A COM library reference is a reference to a type library (DLL, TLB, OLB) that has been selected in the References dialog box.

When the Package and Deployment Wizard determines the files to deploy with your application, the Package and Deployment Wizard reviews the project file to determine which components and which COM library references the project uses. The Package and Deployment Wizard then searches for any dependency files (.dep) that are associated with these components to determine if any supporting files must be redistributed with the application.

Verify that the project does not reference any components or libraries that are not required so that the Package and Deployment Wizard does not try to redistribute files that the application does not require.

Project components
To identify and to minimize references to components in your project, follow these steps: <ol> Open your project in Visual Basic 6.0.</li> On the Project menu, click Components.</li> Click to select the Selected Items Only check box to view only the components that your project currently references.</li> <li>Click to clear the check box next to any component that your project does not use.

Note If you do not know whether your project uses a component, click to clear the check box next to that component. If you receive an error message that is similar to the following, your application uses that component:

Can't remove control or reference; in use

Typically, the component is a control that is used on a form.</li> <li>For the remaining components that are selected, make a note of the version and the location of the library that your application is using.</li> <li>To close the Components dialog box, click OK.</li></ol>

Project references
To identify and to minimize references to COM libraries in your project, follow these steps: <ol> <li>Open your project in Visual Basic 6.0.</li> <li>On the Project menu, click References.</li> <li>Notice the reference libraries that are selected. Every Visual Basic 6.0 application requires the following references. You cannot remove these references. <ul> <li>Visual Basic for Applications</li> <li>Visual Basic runtime objects and procedures</li> <li>Visual Basic Objects and Procedures</li></ul>

Other reference libraries that are selected may not be required for your application.</li> <li>To remove a reference to a reference library that your application does not use, click to clear the check box next to the reference library name.

Note If you do not know whether your application uses a reference library, click to clear the check box to that reference library. If you receive an error message such as the following, your application uses that reference library:

Can't remove control or reference; in use

Restore these references before you go to step 5.</li> <li>For the remaining references that are selected, make a note of the version and the location of the reference library.</li> <li>To close the References dialog box, click OK.</li></ol>

Prepare the Redist folder
The Redist folder is located on the packaging computer. By default, the Redist folder is located in the following folder:

C:\Program Files\Microsoft Visual Studio\VB98\Wizards\PDWizard

After the Package and Deployment Wizard determines the application's dependencies, the Package and Deployment Wizard tries to locate the files that it has determined must be included with the Setup package. The first location that the Package and Deployment Wizard scans is the Redist folder.

If the Package and Deployment Wizard does not locate the required files in the Redist folder, it tries to locate the files in other folders, such as the System32 folder. This behavior may cause problems because your operating system may contain versions of system files that are not compatible with earlier operating systems. Therefore, make sure that the Redist folder contains the correct versions of any files that the Package and Deployment Wizard copies from your system.

If you have installed Visual Basic 6.0 Service Pack 4 or later, the Redist folder already contains most of the files that the Package and Deployment Wizard requires for the package. However, if you have specific versions of files that you want to redistribute with the application, make sure that you copy them manually to the Redist folder.

Additionally, if you use a packaging script that you have saved from an earlier application packaging project, the Package and Deployment Wizard collects the files from the location that appears in the earlier packaging script. The Package and Deployment Wizard will not collect the dependencies from the Redist folder unless it collected them from the Redist folder earlier.

Troubleshoot deployment issues of Visual Basic 6.0 applications
Many tools and resources exist to help you troubleshoot the deployment of your Visual Basic 6.0 application. The following tools and link provide information that you can use to troubleshoot common issues that may occur when you deploy your application.

Tools for troubleshooting deployment issues
The following tools monitor registry access, monitor file access, determine file dependencies, and determine the versions of loaded modules.

The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, about the performance or reliability of these products.

Regmon
Regmon (Regmon.exe) monitors registry access on a real-time basis. You can use Regmon to determine which applications are accessing the Windows registry. For more information about Regmon, visit the following Sysinternals Freeware Web site:

http://www.microsoft.com/technet/sysinternals/default.mspx

To use Regmon, follow these steps: <ol> <li>Install Regmon. To obtain Regmon, visit the following Sysinternals Freeware Web site:

http://www.microsoft.com/technet/sysinternals/utilities/regmon.mspx

</li> <li>Start Regmon. Notice that Regmon immediately starts to log all registry activity.</li> <li>On the File menu, click to remove the check mark next to Capture Events to stop logging.</li> <li>Prepare your application for monitoring. When you are ready to monitor your application, go to step 5.</li> <li>On the File menu in Regmon, click to select Capture Events.</li> <li>Reproduce the problem that you are trying to solve.</li> <li>Switch to Regmon, and then click to remove the check mark next to Capture Events to stop logging.</li> <li>On the File menu, click Save. Save the log file as a .log file so that you can analyze the output.

Note You may want to import the .log file into Microsoft Excel so that you can filter the data more easily.</li></ol>

For more information about Regmon, see the Regmon online Help file.

Filemon
Filemon (Filemon.exe) monitors file access on a real-time basis. You can use Filemon to determine which applications are accessing files on the system. For more information about Filemon, visit the following Sysinternals Freeware Web site:

http://www.microsoft.com/technet/sysinternals/default.mspx

To use Filemon, follow these steps: <ol> <li>Install Filemon. To obtain Filemon, visit the following Sysinternals Freeware Web site:

http://www.microsoft.com/technet/sysinternals/utilities/filemon.mspx

</li> <li>Start Filemon. Notice that Filemon immediately starts to log all file activity.</li> <li>On the File menu, click to remove the check mark next to Capture Events to stop logging.</li> <li>Prepare your application for monitoring. When you are ready to monitor your application, go to step 5.</li> <li>On the File menu in Filemon, click to select Capture Events.</li> <li>Reproduce the problem that you are trying to solve.</li> <li>Switch to Filemon, and then click to remove the check mark next to Capture Events to stop logging.</li> <li>On the File menu, click Save. Save the log file as a .log file so that you can analyze the output.

Note You may want to import the .log file into Microsoft Excel so that you can filter the data more easily.</li></ol>

For more information about Filemon, see the Filemon online Help file.

Dependency Walker
Dependency Walker (Depends.exe) is used to determine the explicit dependencies that a file has. A dependency is a secondary file that a file requires to load or to run correctly. For example, a Microsoft Visual Basic application depends on the Microsoft Visual Basic run-time files.

Dependency Walker also includes a profiling feature that you can use to monitor the way that your application loads and the way that your application runs. This feature is useful for troubleshooting a Visual Basic application that has problems during startup. For more information about Dependency Walker, visit the following Dependency Walker Web site:

http://www.dependencywalker.com

To use Dependency Walker to profile your application, follow these steps: <ol> <li>Install Dependency Walker. To obtain Dependency Walker, visit the following Dependency Walker Web site:

http://www.dependencywalker.com

</li> <li>Start Dependency Walker.</li> <li>On the File menu, click Open.</li> <li>In the Open dialog box, click the application's .exe file, and then click Open.</li> <li>On the Profile menu, click Start Profiling.</li> <li>In the Profile module dialog box, configure the options that you want, and then click OK.</li></ol>

You can view the log window while your application is loading to see which modules load successfully.

For more information about Dependency Walker, see the Dependency Walker online Help file.

back to the top

ListDLLs
ListDLLs outputs the names and the versions of all modules that are loaded in a specific process. You can use ListDLLs when a deployed application works on some computers but not on others. You can also use it to compare the versions of modules that are loaded. This information is helpful for determining if any mismatches exist between the loaded modules and your application's dependencies.

To use ListDLLs, follow these steps: <ol> <li>Install ListDLLs. To obtain ListDLLs, visit the following Sysinternals Freeware Web site:

http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/ListDlls.mspx

Note ListDLLs is a console application. Therefore, you may want to copy the ListDLLs.exe file to a folder that is easily accessible on the computer, such as C:\.</li> <li>Start your application.</li> <li>At the command prompt, type the following command, and then press ENTER:

Listdlls MyApplication.exe > C:\MyApplicationOutput.txt

</li></ol>

The output file will contain the names and the versions of all modules that were loaded in process to your application.

For more information about tools that you can use to troubleshoot deployed Visual Basic 6.0 applications, click the following article numbers to view the articles in the Microsoft Knowledge Base:

198038 Useful tools for Package and Deployment issues

Common deployment issues of Visual Basic applications
For more information about common issues with deploying Visual Basic 6.0 applications, click the following article numbers to view the articles in the Microsoft Knowledge Base:

831491 You receive multiple &quot;System files are out of date&quot; error messages when you install a Visual Basic 6.0 application

193270 Troubleshooting VB application installation issues

330314 Your computer does not restart after you install a Microsoft Visual Basic 6.0 application that includes a Msvcrt.dll file

216231 Application Setup errors while displaying &quot;copying files, please stand by&quot;

200271 How to diagnose and resolve some automation errors

254166 Distribution of Microsoft Scripting Runtime Library fails

216158 Multiple &quot;please insert disk&quot; messages when installing VB6 application

197580 Distribution issues with Riched32.dll

Common deployment issues of database applications
For more information about common issues with deploying Visual Basic 6.0 database applications, click the following article numbers to view the articles in the Microsoft Knowledge Base:

213846 Deploy database applications with the Package and Deployment Wizard (PDW)

299457 Error &quot;can't find installable ISAM&quot; when you connect to Access database with intrinsic DataControl

217754 How to control which MDAC version the Package and Deployment Wizard (PDW) distributes

299645 Error &quot;unable to register Msado15.tlb&quot; if you use a PDW package to install a VB application

Deploy your Visual Basic 6.0 application by using alternative installer technologies
Frequently, developers deploy Visual Basic 6.0 application packages by using alternative installer technologies, such as Microsoft Windows Installer, instead of by using the Package and Deployment Wizard. However, if you use alternative installer technologies, unexpected problems may occur during deployment.

Note Microsoft only supports the deployment of a Visual Basic 6.0 application if you deploy the application by using the Package and Deployment Wizard.

If you plan to use other deployment technologies, consider the following recommendations to help you successfully redistribute your application.

Redistribute minimum dependencies
The following files are the minimum dependencies that are required for any simple Visual Basic 6.0 application to function:
 * Msvbvm60.dll
 * Oleaut32.dll
 * Olepro32.dll
 * Asycfilt.dll
 * Stdole2.tlb
 * Comcat.dll

If you are using Visual Studio Installer to build an installer package, these files are already included in a merge module that is added to your installer package when you build the installer package. If you are using an alternative installer technology, make sure that you redistribute these files, together with any other dependencies that your application requires.

If you want to add these files manually to your redistribution package, copy these files from the Redist folder on a computer where Visual Basic 6.0 and its latest service pack are installed. By using this method, you can make sure that your package does not include newer versions of operating system files that may cause problems during installation.

Build a Setup package by using the Package and Deployment Wizard
Consider building a Setup package for the application by using the Package and Deployment Wizard before you build a package by using an alternative technology. This method will help you determine what dependencies the Package and Deployment Wizard includes in its Setup package. <ol> <li>Assemble a Setup package by using the Package and Deployment Wizard.</li> <li>Open the Setup.lst file, and then view the [Bootstrap Files] section and the [Setup1 Files] section for the following: <ul> <li>The [Bootstrap Files] section lists the minimum dependencies that are mentioned in the &quot;Redistribute minimum dependencies&quot; section, together with the Vb6stkit.dll file.

Note Only a Package and Deployment Wizard Setup package requires the Vb6stkit.dll file.</li> <li>The [Setup1 Files] section lists all other dependencies and any other files that you have added to the Setup package.</li></ul>

Review these lists to verify that your alternative installation package also installs these files.</li></ol>

After you have followed these steps, if you are still experiencing problems when you run the deployed application, try to install the application by using the Setup package that you built by using the Package and Deployment Wizard. Then, verify that the application that you installed by using the Package and Deployment Wizard Setup package works successfully. If you cannot do this, consider troubleshooting the issue by using one of the tools that is mentioned in the &quot;Tools for troubleshooting deployment issues&quot; section.

For more information about third-party installers and Visual Basic applications, click the following article numbers to view the articles in the Microsoft Knowledge Base:

257773 Support for third-party installers

Keywords: kbhowto kbdeployment KB830761

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.