如果你用的是vb6,而且指的是你在編譯程序的時候?qū)懙陌姹咎?,比?.0.1可以用app的屬性得到
成都創(chuàng)新互聯(lián)公司公司2013年成立,是專業(yè)互聯(lián)網(wǎng)技術服務公司,擁有項目成都網(wǎng)站設計、成都網(wǎng)站制作網(wǎng)站策劃,項目實施與項目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元濟寧做網(wǎng)站,已為上家服務,為濟寧各地企業(yè)和個人服務,聯(lián)系電話:18980820575
MsgBox App.Major "." App.Minor "." App.Revision
其中major是主版本,minor是次版本,revision是修正
在.net中會比較麻煩點,參考下面
Type FileInfo
wLength As Integer
wValueLength As Integer
szKey As String * 16
dwSignature As Long
dwStrucVersion As Long
dwFileVersionMS As Long
dwFileVersionLS As Long
End Type
' NOTE: The following Declare statements are case sensitive.
Declare Function GetFileVersionInfo Lib "Version" _
Alias "GetFileVersionInfoA" (ByVal FileName$, _
ByVal dwHandle, ByVal cbBuff, ByVal lpvData$)
Declare Function GetFileVersionInfoSize Lib "Version" Alias _
"GetFileVersionInfoSizeA" (ByVal FileName$, dwHandle)
Declare Sub hmemcpy Lib "Kernel32" Alias "RtlMoveMemory" _
(hpvDest As Any, hpvSource As Any, ByVal cbBytes)
Function LOWORD(x As Long) As Integer
LOWORD = x And HFFFF
' Low 16 bits contain Minor revision number.
End Function
Function HIWORD(x As Long) As Integer
HIWORD = x \ HFFFF
' High 16 bits contain Major revision number.
End Function
'----------------------------------------
'以下為執(zhí)行模塊,在 VBE 界面按 F5 執(zhí)行
'----------------------------------------
Function displayVersion()
Dim x As FileInfo
Dim FileVer As String
Dim FileName As String
Dim dwHandle, BufSize, lpvData$, R
'*** Get Version Information If Available ****
FileVer = ""
'FileName = 路徑
FileName = Environ("windir") "\system32\msjet40.dll"
BufSize = GetFileVersionInfoSize(FileName, dwHandle)
If BufSize = 0 Then
MsgBox "Invalid File Name or no Version information available"
Exit Function
End If
lpvData$ = Space$(BufSize)
R = GetFileVersionInfo(FileName, dwHandle, BufSize, lpvData$)
hmemcpy x, ByVal lpvData$, Len(x)
'**** Parse File Version Number ****
FileVer = Trim$(Str$(HIWORD(x.dwFileVersionMS))) + "."
FileVer = FileVer + Trim$(Str$(LOWORD(x.dwFileVersionMS))) + "."
FileVer = FileVer + Trim$(Str$(HIWORD(x.dwFileVersionLS))) + "."
FileVer = FileVer + Trim$(Str$(LOWORD(x.dwFileVersionLS)))
MsgBox FileVer, 64, "Version of " FileName
End Function
本文來自CSDN博客,轉(zhuǎn)載請標明出處:
Try
Me.Text = "版本V" Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString()
Catch ex As Exception
Me.Text = "未知版本"
End Try
版本設置有一種常見的方法叫:Semantic Versioning(語義版本)
這是一種成熟的版本更新方法,因此有很多相關的周邊設施可用
推薦你看看這篇文章:語義版本號(Semantic Versioning)
文中提及了GitVersion,可以在每次git提交代碼后自動生成version;
pipline用起來簡直不要太爽
這個你把1.0.2.3這個字符串處理下就可以了。
這個屬于字符串的處理