Aracılığıyla paylaş


Reference3.Identity Özellik

Başvuru benzersiz tanımlayıcı alır.

Ad alanı:  VSLangProj80
Derleme:  VSLangProj80 (VSLangProj80.dll içinde)

Sözdizimi

'Bildirim
ReadOnly Property Identity As String
    Get
string Identity { get; }
property String^ Identity {
    String^ get ();
}
abstract Identity : string
function get Identity () : String

Özellik Değeri

Tür: System.String
Döndürülen dize başvuru türüne göre değişir.

Başvuru türü

Döndürülen değer

Derleme

Derleme adı (yol ve uzantı olmadan derleme adı)

COM

Biçim şöyledir:

"GUID\major.minor\localeid\wrappertool"

Örnek:

"{00000205-0000-0010-8000-00AA006D2EA4}\2.5\409\tlbimp"

ActiveX Veri Nesneleri 2.5 için döndürülür.

Yerel

Başvurulan derleme birleştirme kimliği.

Yüklenen

Reference2.Identity

Açıklamalar

Tüm bileşenleri bir benzersiz tanımlayıcısı vardır. Identity Özelliğini alır bu bilgi. Koleksiyonda zaten var olan başvuru olarak aynı kimliğe sahip bir başvuru eklemek çalışırsanız, bir özel durum oluşturuldu olarak bu her başvuru için benzersiz bir özelliktir. Bu özellik, dizin oluşturma için uygundur Reference3 kullanarak toplama Item yöntemi.

Örnekler

Bu örnek, bir derleme ve açık com başvurusu ekler Visual Basic veya Visual C# Proje ve görüntüler Identity her özellik. Bir eklenti bu örneği çalıştırmak için bkz: Nasıl Yapılır: derlemek ve otomasyon nesne modeli kod örnekleri çalıştırma.

Eklenen başvurusu için varsayılan yolları şunlardır: < yükleme kök >\Program Files\Microsoft.NET\Primary Interop Assemblies ADODB.dll dosyasını için ve < yükleme kök >spcommon.dll \Program Files\Common Files\SpeechEngines\Microsoft. < dosya yolu > Değiştir Bu veya diğer uygun dosya yolları örnekte.

Imports VSLangProj
Imports VSLangProj2
Imports VSLangProj80
Public Sub OnConnection(ByVal application As Object,_
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    applicationObject = CType(application, DTE2)
    addInInstance = CType(addInInst, AddIn)
    ShowIdentity (applicationObject)
End Sub
Sub ShowIdentity(ByVal dte As DTE2)
    Dim aProject As Project
    Dim aVSProject As VSProject2
    aProject = applicationObject.Solution.Projects.Item(1)
    aVSProject = _
CType(applicationObject.Solution.Projects.Item(1).Object, VSProject2)
    ' Add an Assembly reference and display its identity.
    Dim newRef As Reference3
    ' Replace the <file path> with an actual file path.
    newRef = aVSProject.References.Add("<file path>\adodb.dll")
    MsgBox("Added an Assembly reference, named: " & newRef.Name)
    MsgBox("The Identity of " & newRef.Name & " is " & newRef.Identity)
    ' Add a COM reference and display its identity.
    ' Replace the <file path> with an actual file path.
    newRef = aVSProject.References.Add("<file path>\spcommon.dll")
    MsgBox("Added a COM reference, named: " & newRef.Name)
    MsgBox("The Identity of " & newRef.Name & " is " & newRef.Identity)
End Sub
using System.Windows.Forms;
using VSLangProj;
using VSLangProj2;
using VSLangProj80;
public void OnConnection(object application,
 ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    applicationObject = (DTE2)application;
    addInInstance = (AddIn)addInInst;
    ShowIdentity(((DTE2)applicationObject));
}
public void ShowIdentity(DTE2 dte)
{
    // The first project is a Visual Basic or C# project.
    VSProject2 vsProject = 
((VSProject2)(applicationObject.Solution.Projects.Item(1).Object));
    Reference3 aRef = null;
    // Add an Assembly reference and display its identity.
    // Replace <file path> with an actual file path.
    aRef = (Reference3)vsProject.References.Add
(@"<file path>\adodb.dll");
    MessageBox.Show("Added an Assembly reference, named: " 
+ aRef.Name);
    MessageBox.Show("The Identity of " + aRef.Name + " is " 
+ aRef.Identity);
    // Add a COM reference and display its identity.
    // Replace <file path> with an actual file path.
    aRef = (Reference3)vsProject.References.Add
(@"<file path>\spcommon.dll");
    MessageBox.Show("Added a COM reference, named: " 
+ aRef.Name);
    MessageBox.Show("The Identity of " + aRef.Name + " is " 
+ aRef.Identity);
}

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

Reference3 Arabirim

Identity Fazla Yük

VSLangProj80 Ad Alanı