[vb.net] Assembly GUID 가져오기
하나를하더라도최선을
2022-07-09 08:11:52
47,275
0
0
Imports System.Runtime.InteropServices
Module _ASM_GUID_
Public Function ASM_GUID() As String
Dim asm As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly()
''The following line (part of the original answer) is misleading.
''**Do not** use it unless you want to return the System.Reflection.Assembly type's GUID.
'getGUID = assembly.[GetType]().GUID.ToString()
'//fea961de-2778-4732-8de0-9689305de95b
' The following is the correct code.
Dim attribute = CType(asm.GetCustomAttributes(GetType(GuidAttribute), True)(0), GuidAttribute)
Return attribute.Value
End Function
End Module