How to get ArcGIS Pro version via C# API

1142
2
Jump to solution
04-28-2020 03:18 AM
GustavoCruz
New Contributor II

Hi,

We develop an add-in for ArcGIS Pro in .Net / C# which has a custom About screen where among other we display the ArcGIS Pro version.

We followed this snippet (https://github.com/esri/arcgis-pro-sdk/wiki/ProSnippets-Framework#get-arcgis-pro-version) in order to get it but even though I'm running ArcGIS Pro 2.3.3 the version I get with code below is 2.3.0.0.

Assembly.GetEntryAssembly().GetName().Version.ToString(); 

Could this be a bug in the API or are we doing something wrong?

Thanks,

Gustavo

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
UmaHarano
Esri Regular Contributor

Hi,

To get the full file version of ArcGISPro.exe, you can try something like this:

System.Reflection.Assembly assembly = System.Reflection.Assembly.GetEntryAssembly();
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
string fileVersion = fvi.FileVersion;

View solution in original post

2 Replies
UmaHarano
Esri Regular Contributor

Hi,

To get the full file version of ArcGISPro.exe, you can try something like this:

System.Reflection.Assembly assembly = System.Reflection.Assembly.GetEntryAssembly();
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
string fileVersion = fvi.FileVersion;
GustavoCruz
New Contributor II

Hi Uma,


FileVersion property returned "2.3.3.15900", which is more than I want as I'm trying to display the version in the same way it's shown on ArcGIS Pro's "About" screen.

Changing the last line of the code you provided did the trick:

private string GetProVersion()
{
   Assembly assembly = Assembly.GetEntryAssembly();

   FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
   return $"{fvi.ProductMajorPart}.{fvi.ProductMinorPart}.{fvi.ProductBuildPart}";
}

Thank you very much for your help!

0 Kudos