Export (0) Print
Expand All

How to: Determine an Assembly's Fully Qualified Name

To discover the fully qualified name of an assembly in the global assembly cache, use the Global Assembly Cache Tool (Gacutil.exe). See How to: View the Contents of the Global Assembly Cache.

For assemblies that are not in the global assembly cache, you can get the fully qualified assembly name in a number of ways: can use code to output the information to the console or to a variable, or you can use the Ildasm.exe (IL Disassembler) to examine the assembly's metadata, which contains the fully qualified name.

  • If the assembly is already loaded by the application, you can retrieve the value of the Assembly.FullName property to get the fully qualified name. You can use this approach whether or not the assembly is in the GAC. The example provides an illustration.

  • If you know the assembly's file system path, you can call the static (Shared in Visual Basic) AssemblyName.GetAssemblyName method to get the fully qualified assembly name. The following is a simple example.

    using System;
    using System.Reflection;
    
    public class Example
    {
       public static void Main()
       {
          Console.WriteLine(AssemblyName.GetAssemblyName(@".\UtilityLibrary.dll"));
       }
    }
    // The example displays output like the following: 
    //   UtilityLibrary, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null
    
  • You can use the Ildasm.exe (IL Disassembler) to examine the assembly's metadata, which contains the fully qualified name.

For more information about setting assembly attributes such as version, culture, and assembly name, see Setting Assembly Attributes. For more information about giving an assembly a strong name, see Creating and Using Strong-Named Assemblies.

The following code example shows how to display the fully qualified name of an assembly containing a specified class to the console. Because it retrieves the name of an assembly that the app has already loaded, it does not matter whether the assembly is in the GAC.

using System;
using System.Reflection;

class asmname
{
    public static void Main()
    {
        Type t = typeof(System.Data.DataSet);
        string s = t.Assembly.FullName.ToString();
        Console.WriteLine("The fully qualified assembly name " +
            "containing the specified class is {0}.", s);
    }
}
Show:
© 2015 Microsoft