Aracılığıyla paylaş


Reference3.StrongName Özellik

Başvuru bir ortak/özel anahtar çifti ile imzalanmış olup olmadığını alır.

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

Sözdizimi

'Bildirim
ReadOnly Property StrongName As Boolean
    Get
bool StrongName { get; }
property bool StrongName {
    bool get ();
}
abstract StrongName : bool
function get StrongName () : boolean

Özellik Değeri

Tür: System.Boolean
A boolean değerini gösteren başvuru imzalı olup olmadığını bir ortak/özel anahtar çifti.

Yüklenen

Reference2.StrongName

Açıklamalar

Dönen değer, başvuru türüne göre değişir.

Başvuru türü

Döndürülen değer

Derleme

Başvuru güçlü bir adı varsa True.

COM

Yanlış; com nesneleri kesin adı yok.

Yalnızca güçlü adlarıyla birleştirmeleri genel birleştirme önbelleğine yerleştirilebilir. Güçlü adları ve genel birleştirme önbelleği hakkında daha fazla bilgi için bkz: Strong-Named Assemblies, Global Assembly Cache, ve Working with Assemblies and the Global Assembly Cache.

Örnekler

Bu örnek, bir derleme ve açık com başvurusu ekler Visual Basic veya Visual C# Proje. Sonra derleme başvurusu kesin adı olup olmadığını belirler. com başvurusu için StrongName ise yanlış. 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)
    DisplayStrongNameValue(applicationObject)
End Sub
Sub DisplayStrongNameValue(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 strong name value.
    Dim newRef As Reference3
    ' Replace the <file path> with an actual file path.
    newRef = CType(aVSProject.References.Add("<file path>\adodb.dll"), _
    Reference3)
    MsgBox("Added an assembly reference, named: " & newRef.Name)
    MsgBox("The StrongName value of " & newRef.Name & " is " _
    & newRef.StrongName.ToString())
    ' Add a COM reference and display its strong name value.
    ' Replace <file path> with an actual file path.
    newRef = CType(aVSProject.References.Add
("<file path>\spcommon.dll"), Reference3)
    MsgBox("Added a COM reference, named: " & newRef.Name)
    MsgBox("The StrongName value of " & newRef.Name & " is " _
    & newRef.StrongName.ToString())
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;
    DisplayStrongNameValue(((DTE2)applicationObject));
}
public void DisplayStrongNameValue(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 strong name value.
    ' Replace the <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 StrongName value of " + aRef.Name + " is "
+ aRef.StrongName.ToString());
    // Add a COM reference and display its strong name value.
    ' 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 StrongName value of " + aRef.Name + " is "
+ aRef.StrongName.ToString());
}

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

Reference3 Arabirim

StrongName Fazla Yük

VSLangProj80 Ad Alanı