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

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

程序

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

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

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

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

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

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

範例

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

Imports System
Imports System.Reflection

Class asmname
    Public Shared Sub Main()
        Dim t As Type = GetType(System.Data.DataSet)
        Dim s As String = t.Assembly.FullName.ToString()
        Console.WriteLine("The fully qualified assembly name " +
            "containing the specified class is {0}.", s)
    End Sub
End Class
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);
    }
}
#using <System.dll>
#using <System.Data.dll>

using namespace System;
using namespace System::Reflection;

ref class asmname
{
public:
    static void Main()
    {
        Type^ t = System::Data::DataSet::typeid;
        String^ s = t->Assembly->FullName->ToString();
        Console::WriteLine("The fully qualified assembly name " +
            "containing the specified class is {0}.", s);
    }
};

int main()
{
    asmname::Main();
}

請參閱

概念

組件名稱

建立組件

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

全域組件快取

執行階段如何找出組件

其他資源

使用組件設計程式