[GIS] How to you find ArcGIS version programatically

arcmaparcobjectsnet

Is there a way using ArcObjects.net to find out what version of ArcGIS is installed on a machine (i.e. 9.3., 10.0, 10.1)?

Best Answer

In ArcObjects .NET, use the RuntimeManager e.g.:

Listing all installed runtimes:

var runtimes = RuntimeManager.InstalledRuntimes;
foreach (RuntimeInfo runtime in runtimes)
{
  System.Diagnostics.Debug.Print(runtime.Path);
  System.Diagnostics.Debug.Print(runtime.Version);
  System.Diagnostics.Debug.Print(runtime.Product.ToString());
}

or, to just get the currently active runtime:

bool succeeded = ESRI.ArcGIS.RuntimeManager.Bind(ProductCode.EngineOrDesktop);
if (succeeded)
{
  RuntimeInfo activeRunTimeInfo = RuntimeManager.ActiveRuntime;
  System.Diagnostics.Debug.Print(activeRunTimeInfo.Product.ToString());
}

Also in arcpy, you can use GetInstallInfo.