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
To get the full file version of ArcGISPro.exe, you can try something like this:
System<SPAN class="punctuation token">.</SPAN>Reflection<SPAN class="punctuation token">.</SPAN>Assembly assembly <SPAN class="operator token">=</SPAN> System<SPAN class="punctuation token">.</SPAN>Reflection<SPAN class="punctuation token">.</SPAN>Assembly<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetEntryAssembly</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> FileVersionInfo fvi <SPAN class="operator token">=</SPAN> FileVersionInfo<SPAN class="punctuation token">.</SPAN><SPAN class="token function">GetVersionInfo</SPAN><SPAN class="punctuation token">(</SPAN>assembly<SPAN class="punctuation token">.</SPAN>Location<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">string</SPAN> fileVersion <SPAN class="operator token">=</SPAN> fvi<SPAN class="punctuation token">.</SPAN>FileVersion<SPAN class="punctuation token">;</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
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!
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.