R
Russ Green
I'm trying to retrieve the version attribute of the current assembly in
Console and Service applications. I've tried the following method but it
doesn't work for me. Any ideas:
' Return the assembly's Version attribute value.
Public Function GetAssemblyVersion() As String
Dim m_MyAssembly As [Assembly] = [Assembly].GetExecutingAssembly
If m_MyAssembly.IsDefined(GetType(AssemblyVersionAttribute), True) Then
Dim attr As Attribute = _
Attribute.GetCustomAttribute(m_MyAssembly,
GetType(AssemblyVersionAttribute))
Dim version_attr As AssemblyVersionAttribute = DirectCast(attr,
AssemblyVersionAttribute)
Return version_attr.Version.ToString
Else
Return ""
End If
End Function
TIA
Russ
Console and Service applications. I've tried the following method but it
doesn't work for me. Any ideas:
' Return the assembly's Version attribute value.
Public Function GetAssemblyVersion() As String
Dim m_MyAssembly As [Assembly] = [Assembly].GetExecutingAssembly
If m_MyAssembly.IsDefined(GetType(AssemblyVersionAttribute), True) Then
Dim attr As Attribute = _
Attribute.GetCustomAttribute(m_MyAssembly,
GetType(AssemblyVersionAttribute))
Dim version_attr As AssemblyVersionAttribute = DirectCast(attr,
AssemblyVersionAttribute)
Return version_attr.Version.ToString
Else
Return ""
End If
End Function
TIA
Russ