Search code examples
.netexcelvisual-studiovstoadd-in

How can i add the publish version in a textbox for a VSTO Excel Add in . net?


currently i'm updating the publish version manually in a VSTO admin of excel. But i want to add the version as variable to avoid the manual stuff.

i have only found examples in C#. Does anyone knows to do that?

enter image description here


Solution

  • Here's how I return the published version number and release date.

    If you're running the Addin from debug mode, it will not be able to read the publish version.

    Const dateFormat As String = "dd-MMM-yyyy  hh:mm tt"
    Dim publishVersion As String
    Dim releaseDate As String
    
    If (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed) Then
        releaseDate = File.GetLastWriteTime(System.Reflection.Assembly.GetExecutingAssembly().Location).ToString(dateFormat)
        publishVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString()
    Else
        releaseDate = File.GetLastWriteTime(Application.ExecutablePath).ToString(dateFormat)
        publishVersion = "Development"
    End If