Reading Public Key Token From Assembly Not Installed in the GAC

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cramer

    Reading Public Key Token From Assembly Not Installed in the GAC

    How can I programmaticall y read the public key token, Version, and Culture
    values of an assembly that is not yet installed into the GAC, and all I have
    is the assembly's containing dll file on disk?

    I have searched, but the closest thing I found is the FileVersionInfo class
    that lets me get at the *file* version (which isn't necessarily the
    *assembly* version).

    What I would like to do is programmaticall y look at a dll file on disk, and
    somehow retrieve from it the public key token, version, and culture values
    for a contained assembly (assuming it contains only one assembly would be
    fine).

    Thanks.




  • Marc Gravell

    #2
    Re: Reading Public Key Token From Assembly Not Installed in the GAC

    AssemblyName an = AssemblyName.Ge tAssemblyName(p ath);
    Version version = an.Version;
    byte[] keyToken = an.GetPublicKey Token();
    CultureInfo culture = an.CultureInfo;

    Marc

    Comment

    Working...