Share via


HOW TO:決定組件的完整名稱

更新:2007 年 11 月

有幾種方式可以在全域組件快取中探索組件的完整名稱:

程序

若要使用 .NET Framework 組態工具在全域組件快取中檢視組件的完整名稱

  1. 按一下 [開始] 按鈕,指向 [系統管理工具],然後按一下 [Microsoft .NET Framework 組態]。

  2. 按一下 [管理組件快取],然後按一下 [檢視組件快取中的組件清單]。

如需使用全域組件快取工具檢視組件完整名稱的詳細資訊,請參閱 HOW TO:檢視全域組件快取的內容

對於不在全域組件快取中的組件,您可以使用程式碼將資訊輸出到主控台或變數,或者可以使用 MSIL 反組譯工具 (Ildasm.exe) 以檢查包含完整名稱的組件中繼資料。

如需設定版本、文化特性和組件名稱等設定組件屬性的詳細資訊,請參閱設定組件屬性。如需給予組件強式名稱 (Strong Name) 的詳細資訊,請參閱建立和使用強式名稱的組件

範例

下列程式碼範例會示範如何向主控台顯示包含指定類別的組件完整名稱。

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

請參閱

概念

組件名稱

建立組件

全域組件快取

執行階段如何找出組件

其他資源

建立和使用強式名稱的組件

使用組件設計程式