Get Installed ArcGIS Pro Version

74
2
Jump to solution
11-07-2018 07:12 AM
Highlighted
by
Occasional Contributor II

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

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
by
Occasional Contributor II

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

Reply
0 Kudos
2 Replies
Highlighted
Esri Regular Contributor

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

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

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

Reply
0 Kudos