Select to view content in your preferred language

Restrict add-in to specific patch using DAML

868
5
Jump to solution
11-09-2022 08:33 AM
StephenRhea_NV5
Frequent Contributor

Is there a way to restrict an add-in to a specific patch version, preferably using DAML? I know the desktopVersion in Config.daml will restrict down to the minor version, but some of our add-ins make heavy use of the GetZsFromSurfaceAsync method, which had a bug until 2.9.4. We're developing against 2.9.5, so we're taking full advantage of the fix. If any of our users are below 2.9.4, we'd like to either prevent the add-in from loading or disable it using states and conditions so they don't get incorrect values from that method.

1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

If you can't do this through the DAML file, this post shows how to get the ArcGIS Pro version information through code.

View solution in original post

0 Kudos
5 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

You can specify 2.9.buildno  in config.daml in the AddInInfo tag's desktopVersion attribute.  To find the buildno for 2.9.5 you can look in your control panel under programs / features.  The screen shot below is the version number desktopVersion number for 3.0.   You can also create a new add-in with ArcGIS Pro 2.9.5 installed which will fill in the minimum desktopVersion for 2.9.5 in your config.daml.

Wolf_0-1668013521134.png

 

See here:  ProConcepts Advanced Topics · Esri/arcgis-pro-sdk Wiki (github.com)

 

0 Kudos
StephenRhea_NV5
Frequent Contributor

Thanks for responding so quickly! I updated the desktopVersion to 2.9.5 on my machine, which also has 2.9.5 installed, then compiled and copied the add-in to a VM with 2.9.2 installed. The VM still loaded the add-in, which is what I'm trying to avoid. Is there maybe a way to get the Pro patch number through the API?

0 Kudos
KenBuja
MVP Esteemed Contributor

If you can't do this through the DAML file, this post shows how to get the ArcGIS Pro version information through code.

0 Kudos
StephenRhea_NV5
Frequent Contributor

Doesn't appear to be possible through DAML, so a combination of desktopVersion=2.9.32739 and the code from that post (shown below) is the way to go.

 

System.Reflection.Assembly assembly = System.Reflection.Assembly.GetEntryAssembly();
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
if (fvi.FileBuildPart < 4)
    // Disable add-in

 

@WolfI created a new add-in and copied the desktop version (2.9.32739) into my existing add-in, and Pro 2.9.2 still loaded it. It leads me to believe that desktopVersion only looks at the major and minor versions

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Just create a new add-in on your development machine which should have ArcGIS Pro 2.9.5 installed.  Then open the config.daml of the newly created add-in and copy the desktopVersion attribute.  

0 Kudos