Version


Supported with:
  • Engine
  • ArcView
  • ArcEditor
  • ArcInfo
  • Server
Library dependencies: none

Additional library information: Contents, Object Model Diagram

ArcGIS Engine, Desktop, and Server can now be installed in distinct locations. For example, Desktop and Engine can be installed in their own respective installation locations. Because the applications no longer share the same files, one application can receive a service pack without affecting the other applications. This change, however, introduces new requirements when writing Engine applications: Engine applications must bind to a specific ArcGIS installation. The Version library exposes methods that you can use to enumerate and bind to the ArcGIS products available on your machine.

See the following sections for more information about this namespace:

Writing Engine applications

If you are writing an independent Engine application that utilizes any of the thousands of components supplied with ArcGIS, you must programmatically bind to a specific ArcGIS product on your machine before using these components. Calling RuntimeManager::BindLicense will bind your engine application to the specified ArcGIS product and automatically initialize it with the specified license level. Alternatively, you can call RuntimeManager::Bind prior to calling the usual AoInitialize logic. The RuntimeManager functionality is accessed using the ESRI.ArcGISVersion.dll assembly located in the program files\common files\ArcGIS\bin folder. See the following code example:
[C#]
/****** Option 1: ******/
ESRI.ArcGIS.RuntimeManager.BindLicense(ProductCode.EngineOrDesktop);
//Instantiate engine component.
IDocument doc = new ESRI.ArcGIS.ArcMapUI.MxDocument();

/****** Option 2: ******/
if (!RuntimeManager.Bind(ProductCode.Desktop))
    MessageBox.Show("Could not bind to Desktop");
// Usual engine initialization code follows from here (AoInitialize).
IAoInitialize init = new AoInitializeClass();
init.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcInfo);
//Instantiate engine component.
IDocument doc = new ESRI.ArcGIS.ArcMapUI.MxDocument();
[VB.NET]
'***** Option 1: *****
ESRI.ArcGIS.RuntimeManager.BindLicense(ProductCode.EngineOrDesktop)
'Instantiate engine component.
Dim doc As IDocument = New ESRI.ArcGIS.ArcMapUI.MxDocument()

'***** Option 2: *****
If Not RuntimeManager.Bind(ProductCode.Desktop) Then
    MessageBox.Show("Could not bind to Desktop")
End If
' Usual engine initialization code follows from here (AoInitialize).
Dim init As IAoInitialize = New AoInitializeClass()
init.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcInfo)
'Instantiate engine component.
Dim doc As IDocument = New ESRI.ArcGIS.ArcMapUI.MxDocument()

Querying for ArcGIS installations

You can also use the Runtime Manager to enumerate the ArcGIS installations currently installed on a machine. See the following code example:
[C#]
var runtimes = RuntimeManager.InstalledRuntimes;

foreach (var info in runtimes)
{
    System.Diagnostics.Debug.Print(info.Product.ToString());
    System.Diagnostics.Debug.Print(info.Version);
    System.Diagnostics.Debug.Print(info.Path);
}
[VB.NET]
Dim runtimess = RuntimeManager.InstalledRuntimes

For Each info In runtimes
    System.Diagnostics.Debug.Print(info.Product.ToString())
    System.Diagnostics.Debug.Print(info.Version)
    System.Diagnostics.Debug.Print(info.Path)
Next