TheRookie32
asked on
How can i get the version number for my DLL?
Is there an assembly i can use to get it? I built a diagnostic program to get a few pieces of information about the users computer and am converting it into a dll. The code i used on the form was:
'Application Version Number
Dim version As String = Forms.Application.ProductV ersion.ToS tring()
Dim versionparts As String() = Split(version, ".")
Dim iPos As Long = version.LastIndexOf(".")
Return version.Substring(0, iPos)
But there isnt any forms in the dll...
Thanks!
'Application Version Number
Dim version As String = Forms.Application.ProductV
Dim versionparts As String() = Split(version, ".")
Dim iPos As Long = version.LastIndexOf(".")
Return version.Substring(0, iPos)
But there isnt any forms in the dll...
Thanks!
VB example frpm above link:
Public Sub GetFileVersion()
' Get the file version for the notepad.
Dim myFileVersionInfo As FileVersionInfo = FileVersionInfo.GetVersion Info("%sys temroot%\N otepad.exe ")
' Print the file name and version number.
textBox1.Text = "File: " & myFileVersionInfo.FileDesc ription & ControlChars.Cr & _
"Version number: " & myFileVersionInfo.FileVers ion
End Sub 'GetFileVersion
Public Sub GetFileVersion()
' Get the file version for the notepad.
Dim myFileVersionInfo As FileVersionInfo = FileVersionInfo.GetVersion
' Print the file name and version number.
textBox1.Text = "File: " & myFileVersionInfo.FileDesc
"Version number: " & myFileVersionInfo.FileVers
End Sub 'GetFileVersion
ASKER
This wont work within a DLL as its a class and cant have the sub...
This is how i am getting the os version...
Public Shared ReadOnly Property OSVersion()
Get
'Display operating system and version
Return Environment.OSVersion.ToSt ring
End Get
End Property
How can i change the code you gave to fit to be a property of a class?
This is how i am getting the os version...
Public Shared ReadOnly Property OSVersion()
Get
'Display operating system and version
Return Environment.OSVersion.ToSt
End Get
End Property
How can i change the code you gave to fit to be a property of a class?
I'm confused now.
Do you want your DLL to determine its own version, or the version of any file specified, or just the OS version?
How are you converting the EXE to a DLL?
Do you want your DLL to determine its own version, or the version of any file specified, or just the OS version?
How are you converting the EXE to a DLL?
ASKER
Sorry, was in a bit of a rush to get that last post in before i left for the night. I need it to get the version # of the DLL. To convert the exe to a dll, i created a new class library and then brought the code over and declared it public, static etc like the example for getting the OS version. Cheers!
ASKER
Did i answer your question correctly or do you need more info to solve this one?
If you can't use FileVersionInfo, that pretty much leaves the GetFileVersionInfo() API. I'll gen up an example later tonight.
ASKER
You have time to generate an example yet?
Oops - guess who let it slip. I'll do it this weekend.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdiagnosticsfileversioninfoclasstopic.asp?frame=true
Note that not all DLLs will have version info.
c# example:
FileVersionInfo fvi=FileVersionInfo.GetVer
FoundVer=fvi.FileMajorPart
+fvi.FileMinorPart.ToStrin
+fvi.FileBuildPart.ToStrin
+fvi.FilePrivatePart.ToStr