I have an Excel Addin project that I created and a standalone installation file for the same. The addin has its Install Shield Limited Edition - Setup project. As I make changes to the code, I create a new setup file with a new version number.
I want to extract the "Product Version" from the setup project as a string. The image here shows what I want to extract. The "Product Version" is found in "General Information" of the setup project.
I tried using Application.ProductVersion
but I think that gives me Excel's version and not my Addins version.
How can I get the product version for my addin? My purpose is to extract this version number and show it in the addin ribbon so that we can see which version we are using (one of the requirement).
The version is written to the add ins manifest file. To get it you should load it (manifest) and then extract it...
Dim publishVersion As String = String.Empty
Dim assemblyVersion As String = String.Empty
' load the application manifest
Using xmlrdr As XmlReader = XmlReader.Create("ExcelPTCMAddIn.dll.manifest")
xmlrdr.MoveToContent
Do While xmlrdr.Read
If (xmlrdr.Name = "asmv1:assemblyIdentity") Then
publishVersion = xmlrdr.Item("version")
End If
If ((xmlrdr.Name = "assemblyIdentity") AndAlso (xmlrdr.Item("name") = "ExcelPTCMAddIn")) Then ' there're two occurences of "assemblyIdentity" element, either one is OK
assemblyVersion = xmlrdr.Item("version")
End If
Loop
End Using
Let me know how this works out.