How to know ArcGis version in C#

2295
1
Jump to solution
10-30-2012 03:20 AM
MuhammetCiftci
New Contributor II
Hello,

I have a problem since the last version of ArcGis, the 10.1, was released.

My problem is the following :

When using the DataManagement Clip tool, there's a parameter named nodata_value which was a Double in ArcGis 10 and now it's a string. So when someone uses my program with ArcGis 10.1, he gets this error : System.MissingMethodException: Method not found: 'Void ESRI.ArcGIS.DataManagementTools.Clip.set_nodata_value(Double)'.
ArcGis 10.1 : http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000009n000000
ArcGis 10.0 : http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00170000009n000000

So a solution may be to check the current version of ArcGis and give the good parameter :
if(arcgis10_1)
   nodata_value = myDoubleValue.ToString();
else
   nodata_value = myDoubleValue;

But I don't know how to recognize in which version I am.

Thank you for your help.

M. Ciftci
0 Kudos
1 Solution

Accepted Solutions
MuhammetCiftci
New Contributor II
I've found something :

var runtimes = ESRI.ArcGIS.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);
}

The assembly is ESRI.ArcGIS.Version

View solution in original post

0 Kudos
1 Reply
MuhammetCiftci
New Contributor II
I've found something :

var runtimes = ESRI.ArcGIS.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);
}

The assembly is ESRI.ArcGIS.Version
0 Kudos