目前,我正在excel的VSTO管理员中手动更新发布版本。但是我想将版本添加为变量以避免手工操作。
我仅在C#中找到了示例。有谁知道这样做吗?
<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9LNWxpcy5wbmcifQ==” alt =“在此处输入图像描述”>
这是我返回发布的版本号和发布日期的方式。
如果从调试模式运行外接程序,它将无法读取发布的版本。
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