Compartir a través de


How to: Determine an Assembly's Fully Qualified Name 

There are several ways to discover the fully qualified name of an assembly in the global assembly cache:

Procedures

To view the fully qualified names of assemblies in the global assembly cache using the .NET Framework Configuration tool

  1. Click the Start button, point to Administrative Tools, and then click Microsoft .NET Framework Configuration.

  2. Click Manage the Assembly Cache, and then click View List of Assemblies in the Assembly Cache.

For information about using the Global Assembly Cache tool to view the fully qualified names of assemblies, see How to: View the Contents of the Global Assembly Cache.

For assemblies that are not in the global assembly cache, you can use code to output the information to the console or to a variable, or you can use the MSIL Disassembler (Ildasm.exe) 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.

Example

The following code example shows how to display the fully qualified name of an assembly containing a specified class to the console.

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);
    }
}
Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic
' For a class not contained in mscorlib.dll, compile this code with 
' the /r:<dllname> option; for example,compile the code below using:
'    vbc asmname.vb /r:System.Data.dll /r:System.dll /r:System.Xml.dll
' If the class is contained in mscorlib.dll, the /r:<dllname> compiler option is unnecessary.

Class asmname
    Public Shared Sub Main()
        Dim t As Type = GetType(System.Data.DataSet)
        Console.WriteLine("The fully qualified assembly name containing the specified class is {0}.", t.Assembly.FullName.ToString())
    End Sub 'Main
End Class 'asmname

See Also

Concepts

Assembly Names
Creating Assemblies
Global Assembly Cache
How the Runtime Locates Assemblies

Other Resources

Creating and Using Strong-Named Assemblies
Programming with Assemblies