Deploying your solutions  

Packing and deploying ArcGIS Desktop components

This topic is relevant for the following:
Product(s): ArcGIS Desktop: All
Version(s): 9.0, 9.1, 9.2
Language(s): VB6
Experience level(s): Insert comma-separated list of experience levels here



This topic describes how you can package your VB6 components and deploy them to other users.

Exactly what must be packaged depends on the type of development but you should also consider including the following:

It is important not to package any of the files within the ArcGIS installation. If you did this and the user uninstalled your software, there would be a danger that some of the files ArcGIS requires to function correctly might be removed.

The only requirement for installation on the target machine is that it must have ArcGIS Desktop installed.

There are two popular methods for packaging and deploying COM DLLs.

Just the DLL

It is possible to simply give the user a copy of the DLL with instructions on how to register the DLL on the system. Normally, this involves the use of the Windows Utility RegSvr32.EXE. To register a DLL, the user must type a command line similar to that below.

  RegSvr32 MyServer.DLL

To unregister a server, the command is run with the /U switch.

  RegSvr32 /U MyServer.DLL

A dialog box appears when the operation completes. When running regsvr32 on several files, it is advisable to run it in silent mode with the /S switch—this disables the dialog box.

Depending on how the DLL was developed, registering the DLL may not be the only task. The coclasses contained with the DLL may have to be added to the appropriate component categories. Other alternatives include the facility in the applications for commands; the Category Manager utility application; and the ComponentCategoryManager coclass, which is part of the framework subsystem or the creation of a registry script.

Included in the /ArcGIS/DeveloperKit/Tools directory is a small registry script called reg_in_menu.reg. The registry script adds options to the Windows Explorer context menu when DLL, EXE, OLB, and OCX files are selected. The five options provide support for registering and unregistering the files. The context menu is shown in the figure below.

Using registry scripts

After the server is registered on the system, registry scripts provide a good mechanism for adding supplemental information about the server to the registry, including the component category information. These registry scripts can either be written by hand or generated from the Compile and Register Visual Basic add-in. A sample script is shown below. The lines beginning "[HKEY" must all be on one line in the file.

[Visual Basic 6]
REGEDIT4

; This Registry Script enters CoClasses Into their appropriate Component Category ; Use this script during installation of the components

; Coclass: prjDisplay.ZoomIn ; CLSID: {FC7EC05F-6B1B-4A59-B8A2-37CE33738728} ; Component Category: ESRI Mx Commands [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{FC7EC05F-6B1B-4A59-B8A2-37CE33738728}\Implemented Categories\{B56A7C42-83D4-11D2-A2E9-080009B6F22B}]
; Coclass: prjDisplay.ZoomOut ; CLSID: {2C120434-0248-43DB-AD8E-BD4523A93DF8} ; Component Category: ESRI Mx Commands [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{2C120434-0248-43DB-AD8E-BD4523A93DF8}\Implemented Categories\{B56A7C42-83D4-11D2-A2E9-080009B6F22B}

Using an installation program

Most setup packages work well with registry scripts. For example, the Visual Basic Package and Deployment wizard provides a straightforward way of creating setup programs. To create a setup program for your server, follow these steps:

  1. Click the Start menu and click the Package and Deployment Wizard. The dialog box below is displayed. Click the Visual Basic project to be packaged and choose the package option. This will build the setup program and gather all files required by the setup program into a support directory for easy regeneration of the package. The wizard then performs some checks to ensure that the server created by the Visual Basic project is up-to-date with its source files. If not, you are given the option to recompile the project.


  2. Next, choose the package type; this will normally be a Standard Setup Package.

  3. The next step allows you to specify the folder where the package is created. This folder will contain the Setup executable and cabinet files and a supporting folder with all the files used to build the package.

  4. Ensure that the files list shown doesn't include any ArcGIS installed files and that any other files required by the installation are added. The additional files normally include a registry script to perform advanced registration, along with help files, and so on.

  5. The next panel depends on whether a registry file was added in the previous step. If the file was added, the dialog box below is shown. If no file was added, go to Step 6. The simplest option is to accept the default. This will cause the registry script to be executed when the setup program has registered the servers on the target machine but will not copy the registry script to the machine.

  6. The wizard then asks if one or multiple cabinet files will be created. This depends on whether or not the setup program will span multiple floppy disks.

  7. Next, follow a couple of panels asking for the Installation Screen title and where on the Windows Start menu the setup program should group files. Often when installing DLLs it is not appropriate to define an entry on the Start menu. Sometimes, even with DLLs, it may be desirable to add access to documents containing help information.

  8. The next panel allows the user to define the location of the various files after they have been installed. Various macros are defined that will point to different locations, depending on the configuration of the target machine.

  9. The next panel allows files to be marked as shared. Any files of the installation that will be used by other programs or installations must be marked as shared. This ensures that the uninstall program does not remove them automatically, which would break the other programs.

  10. Finally, the Finish panel is displayed. Click Finish to assemble the package. The three files in the package directory—setup, cabinet, and list files—can then be given to third parties for a seamless install.

This is just one method of packaging COM developments. Whatever method you use, the setup procedure must be as simple as possible and involve as few decisions as possible to avoid user frustration.