Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how do I read a files' or assemblys' metadata (date modified, assembly version, etc.)

how do I read a files' or assemblys' metadata (date modified, assembly version, etc.)

Scheduled Pinned Locked Moved C#
csharphelpquestionannouncement
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AfzalHassen
    wrote on last edited by
    #1

    Hi, i've tried 'google'ing to find any article on how i might be able to read the metadata of a file or .net 2.0 rc1 assembly that i've built (e.g. the date the file was last modified, or the author of the assembly, it's version etc), but i seem to have hit a bit of a brick wall, i'm sure there must be a simple (or not) way to read this kind of information about a file programmtically. any help or nudges in the right direction will be greatly appreciated:) Thanks in advance. Afzal "AV-E" Hassen

    W M 2 Replies Last reply
    0
    • A AfzalHassen

      Hi, i've tried 'google'ing to find any article on how i might be able to read the metadata of a file or .net 2.0 rc1 assembly that i've built (e.g. the date the file was last modified, or the author of the assembly, it's version etc), but i seem to have hit a bit of a brick wall, i'm sure there must be a simple (or not) way to read this kind of information about a file programmtically. any help or nudges in the right direction will be greatly appreciated:) Thanks in advance. Afzal "AV-E" Hassen

      W Offline
      W Offline
      Werdna
      wrote on last edited by
      #2

      I'm not sure if it will give you all the info you need, but you can do: Assembly asm = Assembly.Load(filename); then use properties/methods of asm: asm.GetName().Version You can also get attributes of an assembly by using GetCustomAttributes(typeof(AssemblyTitleAttribute), true)

      1 Reply Last reply
      0
      • A AfzalHassen

        Hi, i've tried 'google'ing to find any article on how i might be able to read the metadata of a file or .net 2.0 rc1 assembly that i've built (e.g. the date the file was last modified, or the author of the assembly, it's version etc), but i seem to have hit a bit of a brick wall, i'm sure there must be a simple (or not) way to read this kind of information about a file programmtically. any help or nudges in the right direction will be greatly appreciated:) Thanks in advance. Afzal "AV-E" Hassen

        M Offline
        M Offline
        munishsehgal
        wrote on last edited by
        #3

        Try this... using System; using System.IO; using System.Reflection; public class Meta { public static int Main( ) { // First load the assembly. Assembly a = Assembly.LoadFrom("hello.exe"); // Get all the modules that the assembly supports. Module[] m = a.GetModules( ); // Get all the types in the first module. Type[] types = m[0].GetTypes( ); // Inspect the first type. Type type = types[0]; Console.WriteLine("Type [{0}] has these methods:", type.Name); // Inspect the methods supported by this type. MethodInfo[] mInfo = type.GetMethods( ); foreach ( MethodInfo mi in mInfo ) { Console.WriteLine(" {0}", mi); } return 0; } } ;)

        A 1 Reply Last reply
        0
        • M munishsehgal

          Try this... using System; using System.IO; using System.Reflection; public class Meta { public static int Main( ) { // First load the assembly. Assembly a = Assembly.LoadFrom("hello.exe"); // Get all the modules that the assembly supports. Module[] m = a.GetModules( ); // Get all the types in the first module. Type[] types = m[0].GetTypes( ); // Inspect the first type. Type type = types[0]; Console.WriteLine("Type [{0}] has these methods:", type.Name); // Inspect the methods supported by this type. MethodInfo[] mInfo = type.GetMethods( ); foreach ( MethodInfo mi in mInfo ) { Console.WriteLine(" {0}", mi); } return 0; } } ;)

          A Offline
          A Offline
          AfzalHassen
          wrote on last edited by
          #4

          Thanks guys. i'll give it a shot :) Afzal "AV-E" Hassen

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups