This document is archived and information here might be outdated.  Recommended version.


ArcGIS License Initializer dialog box (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > Visual Studio integration > ArcGIS Visual Studio IDE Integration Framework for extending ArcObjects > ArcGIS License Initializer dialog box

ArcGIS License Initializer dialog box


Summary
The ArcGIS License Initializer dialog box - part of the ArcGIS Visual Studio integrated development environment (IDE) Integration Framework - allows you to select the ArcGIS product and extension licenses to be initialized when your application starts up.

In this topic


You can find step-by-step information on using the different elements of the ArcGIS Visual Studio Integration Framework in the .NET development walkthroughs.

Using the ArcGIS License Initializer dialog box

Beginning with ArcGIS 9.2, all stand-alone applications are required to explicitly initialize with a suitable ArcGIS product license before any ArcObjects component is accessed. You can use the ArcGIS License Initializer dialog box to generate and add license initialization code to the appropriate application startup point in your project.
If you have installed the ArcObjects Software Development Kit (SDK) for the Microsoft .NET Framework, licensed it with an ArcGIS Engine Developer Kit license, and are writing a Windows application, you can use the LicenseControl to initialize your application instead. In this case, remove any redundant license initialization code that was added to the project.
To view the ArcGIS License Initializer dialog box, choose Add ArcGIS License Checking from the Project menu. This dialog box is also shown as a page in the ArcGIS Project Wizard. See the following screen shot:


The options on the ArcGIS License Initializer dialog box are explained as follows:
  • Startup Object - This read-only field displays the current startup type for the project, indicating where license initialization code will be added. For more details, see the Application startup and shutdown section.
  • Products - Displays ArcGIS product licenses with which to initialize the application. The products listed may depend on the products you have installed and also on how the dialog box is accessed (the choice of products may be restricted if using the ArcGIS Project Wizard). Check the check box next to a product to initialize with that product license. If you select more than one product, the license availability of each product is checked until an available license is found. Licenses are checked in ascending functionality order; for example, ArcGIS Engine (the lower license), then ArcGIS Engine Enterprise Geodatabase.
  • Extensions - Displays a list of extensions to check out after the product is initialized. The extensions listed depend on the items in the Products list. Check the check box next to a listed extension to check out that extension when the application runs.
  • Shut down this application if any selected license(s) is not available - Alters behavior of the application if the chosen licenses cannot be found. If checked, the application shuts down if license initialization fails. If this option is not checked, add your own code to terminate or disable any ArcObjects code in your application, as ArcObjects code in an unlicensed application can give unexpected errors.
Click the OK button to add (or update) license initialization code in your project; the LicenseInitializer helper class is added to your project.
You can undo changes to the license initialization code by opening the code file containing the startup object and clicking the Undo button.

Update or remove license initialization

You can rerun this dialog box for the same project at any time to update the products and extensions with which to initialize the application. You can also use this dialog box to completely remove its license initialization code by unchecking all the products before clicking OK. You will be prompted to delete or exclude the LicenseInitializer helper class; click Yes to delete the file. Remove license initialization code before you change the startup object project property.

Application startup and shutdown 

The license initializer attempts to locate the most appropriate application startup method in the project, depending on the startup objects specified in the project property, the language, and project type. See the following:
  • For C# projects, the program always starts in a Main() method:
    • Initialization shutdown code is added at the end of the Main() method.
  • For a VB .NET console application project, it is usually the Main Sub in a module:
    • Initialization shutdown code is added at the end of the Main Sub.
  • For a VB .NET Windows application project, it can be one of the following:
    • Startup event of the application in the My.Application class defined by the Visual Basic Application Model:
      • Initialization shutdown code is added to the beginning of the application shutdown event.
    • Main Sub:
      • Initialization shutdown code is added at the end of the Main Sub.
    • Form.OnLoad event:
      • Initialization shutdown code is added at the beginning of the Dispose method.
In most cases, license initialization code is inserted in the application Startup event or in the Main Sub in a VB .NET project. The only exception is when you have license checking code already added in the Form.OnLoad event. You will get a warning on the Error List window if license initialization code has to be inserted in the OnLoad event. This is because an ArcGIS Engine control on the form may need to access ArcObjects components during form initialization, and form initialization happens before the OnLoad event is raised, for example, a MapControl with a map document property set.
To fix this, clean up license initialization code by first unchecking all products in the dialog box and clicking OK. Make sure code is removed from the OnLoad and Dispose methods. Running the ArcGIS License Initializer dialog box again adds the code to either the Startup event or Main Sub.
If you decide to change the startup object project property, clean up and remove all license initialization code before you make the change.


See Also:

ArcGIS Visual Studio IDE Integration Framework for extending ArcObjects
ArcGIS Project Wizard




Additional Requirements
  • ArcGIS Visual Studio IDE Integration Framework for Visual Studio.