我如何在 VSTO Excel 添加的文本框中添加发布版本。网?

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

目前我正在 excel 的 VSTO 管理员中手动更新发布版本。但我想将版本添加为变量以避免手动操作。

我只找到了 C# 中的示例。有谁知道这样做吗?

这是我return发布的版本号和发布日期。

如果您是 运行 调试模式下的插件,它将无法读取发布版本。

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