How to access Add-In version?

3241
6
04-18-2016 04:27 AM
Highlighted
New Contributor III

Is there a way to access the version of the Add-In (e.g. what is listed in the Config.daml) using the SDK?

For example, with the ArcObjects SDK, you could access the Add-In verison with My.ThisAddIn.Version

Is there a similar way I can access the version using the Pro SDK? I can access the assembly/dll version with the reflection namespace, but this is not linked in any way to the Add-In version from what I can tell.

Thanks

Reply
0 Kudos
6 Replies
Highlighted
Esri Regular Contributor

Hi Luke,

In the config.daml's <AddInInfo> tag,  you can get the desktopVersion attribute and use it within your code as a string property.

To create something similar to what ArcObjects provided, you can do following -

  • Within your Module class, create a nested class to store your add-in's version like this:

internal class Module1 : Module

    {

        public static class MyAddin

        {

            public static string Version => "1.2.5023";

            public static string Name => "ProAppModule1";

           ......

        }

....

  • You can then access this class and the properties similar to ArcObjects. The example below is using the class with a button's click handler.

protected async override void OnClick()

        {

            string myVersion = Module1.MyAddin.Version; //do something with the version

......

Thanks!

Uma Harano

ArcGIS Desktop SDK Team

Reply
0 Kudos
Highlighted
New Contributor III

Hi Uma,

Are you saying I have to hardcode my Add-In version in my module class? Isn't there any way the SDK can tell me the version of my Add-In without me having to manually store it and update it?

Thanks,

Luke

Reply
0 Kudos
Highlighted
Esri Regular Contributor

Hi Luke,

The version is hard coded already into the config.daml. It never changes for the lifetime of that add-in. Once you make your variable, you would not have to update it.

Thanks

Uma Harano

ArcGIS Desktop SDK Team.

Reply
0 Kudos
Highlighted
New Contributor III

I am also looking a way to read the Add-In "Version" Configuration. (Not the desktopVersion) from SDK.

Thanks

Sree

Reply
0 Kudos
Highlighted
by Esri Regular Contributor
Esri Regular Contributor

Hi Sree,

 You can take a look at this sample and see if it has what you need:

AddInInfoManager

It displays version information about add-ins - the 'Version' string is probably what you are looking for:

Reply
0 Kudos
Highlighted
New Contributor III

Hi Kaiser,

I think this will work. Probably I need to find all the add-ins and filter the version# based on my add-in guid.

- My intention is to read the current version of my add-in directly from Config.daml. 

<AddInInfo id="{my add-in guid}" version="1.0" desktopVersion="2.2.12813">

Thanks for the help!

Regards,

Sree

Reply
0 Kudos