tymbow Posted March 6, 2004 Posted March 6, 2004 I'm getting some attributes from the assembly and I can't seem to get the version attribute. When I use the following code it throws an out of bounds exception for the array as there are no elements. The AssemblyVersion attribute is defined and this code works perfectly for every other assembly attribute. Any thoughts on this? Public ReadOnly Property Version() As String Implements IAssemblyInformation.Version Get ' Get the version attribute Dim attrVersion As AssemblyVersionAttribute attrVersion = CType(myAssembly.GetCustomAttributes(GetType(AssemblyVersionAttribute), False)(0), AssemblyVersionAttribute) ' Return the version string Return attrVersion.Version.ToCharArray ' Clear any objects we used attrVersion = Nothing End Get End Property Quote
*Gurus* divil Posted March 6, 2004 *Gurus* Posted March 6, 2004 The correct way to get an assembly's version is not by reading an attribute, but by looking at the Assembly.GetName().Version property. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.