我爲Autodesk Inventor創建了一個AddIn。現在它已完成並安裝在每個用戶工作站上。每當我爲AddIn進行更新時,用戶需要運行安裝程序以獲取最新的更新,我希望這個過程自動化,用戶總是在工作時擁有最新版本。所以在Autodesk Inventor加載過程中會發生檢查。比較FileVersionInfo以檢查舊版本
我會檢查FileVersionInfo
我可以做到這一點使用提供的MSDN網站上的此示例代碼
Public Shared Sub Main(ByVal args() As String)
' Get the file version for the notepad.
' Use either of the following two commands.
FileVersionInfo.GetVersionInfo(Path.Combine(Environment.SystemDirectory, "Notepad.exe"))
Dim myFileVersionInfo As FileVersionInfo = FileVersionInfo.GetVersionInfo(Environment.SystemDirectory + "\Notepad.exe")
' Print the file name and version number.
Console.WriteLine("File: " + myFileVersionInfo.FileDescription + vbLf + "Version number: " + myFileVersionInfo.FileVersion)
End Sub
這導致了這個輸出:
Old File: EMIA_001
Version number: 1.0.6113.27965
New File: EMIA_001
Version number: 1.0.6114.20817
但是,什麼是正確的方式來比較這個版本號彼此?