
3.23.2006
VersionInfo
Back in the C++ days, you get file version info from a Win32 API call which returned you a VERSIONINFO resource. This structure would have things like the copyright, internal product name, etc.
In .NET, the AssemblyInfo.cs source file contains attributes for each of these types of information. Here's how to get at the information at runtime.
In .NET, the AssemblyInfo.cs source file contains attributes for each of these types of information. Here's how to get at the information at runtime.
Assembly asm = Assembly.GetExecutingAssembly();
// use this to get all custom attributes. have array and can walk through it
//object[] atts = asm.GetCustomAttributes( false );
// use this to get directly to a particular type of custom attribute
AssemblyCopyrightAttribute copy = AssemblyCopyrightAttribute.GetCustomAttribute( asm,
typeof( AssemblyCopyrightAttribute ) ) as AssemblyCopyrightAttribute;
Console.WriteLine( copy.Copyright );
Comments:
Post a Comment