Get Installed ArcGIS Pro Version

104
2
Jump to solution
11-07-2018 07:12 AM
MKa
by
Occasional Contributor III

How do I get the version of ArcGIS Pro that is installed.  We need to manage which version is installed on our users machines.  Our configuration needs to be tested on all versions of pro that is released.  So we need to get the exact version that a user has installed on their computer and alert them as to a change they might need to do.

//This returns "2.2.0.0"???
string ArcGISProVersionLookup = System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString();‍‍

This code only seems to return 2.2.0.0, but I want 2.2.3 like below on the About page

0 Kudos
1 Solution

Accepted Solutions
MKa
by
Occasional Contributor III

That was very helpful.  I am able to get the Versions of both the Installed ArcGIS Pro and the Installed .proConfigX version with the following.  You get the ArcGIS Pro version from the GetEntryAssembly() and the  addin/proconfigX version from the GetExecutingAssembly()

//ArcGIS Pro Version (GetEntryAssembly)

public static string GetArcGISVersionInstalled
        {
            get
            {
                string returnVersion = "";               
                    Assembly asm = Assembly.GetEntryAssembly();
                    if (asm != null)
                    {
                        FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location);
                        if (fvi != null)
                        {
                            returnVersion = String.Format("{0}.{1}.{2}", fvi.ProductMajorPart, fvi.ProductMinorPart, fvi.ProductBuildPart);
                        }
                    }               
                return returnVersion;
            }
        }

//addin/proconfigX Version (GetExecutingAssembly)

public static string GetAddinVersion
        {
            get
            {
                string returnVersion = "";               
                    Assembly asm = Assembly.GetExecutingAssembly();
                    if (asm != null)
                    {
                        FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location);
                        if (fvi != null)
                        {
                            returnVersion = String.Format("{0}.{1}.{2}.{3}", fvi.ProductMajorPart, fvi.ProductMinorPart, fvi.ProductBuildPart, fvi.ProductPrivatePart);
                        }
                    }               
                return returnVersion;
            }
        }

View solution in original post

0 Kudos
2 Replies
UmaHarano
Esri Regular Contributor

You could get the File version of ArcGISPro.exe like this:

string fileVersion = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).FileVersion;
MKa
by
Occasional Contributor III

That was very helpful.  I am able to get the Versions of both the Installed ArcGIS Pro and the Installed .proConfigX version with the following.  You get the ArcGIS Pro version from the GetEntryAssembly() and the  addin/proconfigX version from the GetExecutingAssembly()

//ArcGIS Pro Version (GetEntryAssembly)

public static string GetArcGISVersionInstalled
        {
            get
            {
                string returnVersion = "";               
                    Assembly asm = Assembly.GetEntryAssembly();
                    if (asm != null)
                    {
                        FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location);
                        if (fvi != null)
                        {
                            returnVersion = String.Format("{0}.{1}.{2}", fvi.ProductMajorPart, fvi.ProductMinorPart, fvi.ProductBuildPart);
                        }
                    }               
                return returnVersion;
            }
        }

//addin/proconfigX Version (GetExecutingAssembly)

public static string GetAddinVersion
        {
            get
            {
                string returnVersion = "";               
                    Assembly asm = Assembly.GetExecutingAssembly();
                    if (asm != null)
                    {
                        FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(asm.Location);
                        if (fvi != null)
                        {
                            returnVersion = String.Format("{0}.{1}.{2}.{3}", fvi.ProductMajorPart, fvi.ProductMinorPart, fvi.ProductBuildPart, fvi.ProductPrivatePart);
                        }
                    }               
                return returnVersion;
            }
        }

View solution in original post

0 Kudos