I am not aware of an ArcObject interface or class that does this, but that would useful. And I don't have a complete answer for you question, but here is a suggestion that you might be able to build on.
I have an AddIn that has an Extension that checks the ArcMap "loaded" (ThisAddIn.Version
) AddIn version with the version that I have deployed in a shared folder and then warns the user if they are different.
/// <summary>
/// Gets the add in version from the Addinfile
/// </summary>
/// <param name="path">The full path to an Esri AddIn file</param>
/// <returns>Add In Version</returns>
private static string GetAddInVersionFromFile(string path)
{
string version = string.Empty;
if (!File.Exists(path))
throw new FileNotFoundException("AddInFile Not Found", path);
ZipFile file = new ZipFile(path);
foreach (var entry in file.Entries)
{
if (entry.FileName.Equals("config.xml", StringComparison.InvariantCultureIgnoreCase))
{
Stream stream = new MemoryStream();
entry.Extract(stream);
if (stream != null && stream.Length > 0)
{
string xmltext = string.Empty;
stream.Position = 0;
using (TextReader reader = new StreamReader(stream, Encoding.ASCII))
{
xmltext = reader.ReadToEnd();
}
if (!string.IsNullOrEmpty(xmltext))
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.LoadXml(xmltext);
version = (doc["ESRI.Configuration"]["Version"]).InnerText;
break;
}
}
}
}
return version;
}
You could potentially build on this and check the registry folders HKEY_LOCAL_MACHINE\SOFTWARE\ESRI\Desktop10.0\Settings\AddInFolders
and the AddInFolders.xml folder locations and look for your AddIn.
The ZipFile reference is Ionic.Zip.dll which I think is here: http://dotnetzip.codeplex.com/