Share via


Reference3.SpecificVersion-Eigenschaft

Aktualisiert: November 2007

Ruft ab oder legt fest, ob nur eine bestimmte Version des Verweises verwendet wird.

Namespace:  VSLangProj80
Assembly:  VSLangProj80 (in VSLangProj80.dll)

Syntax

Property SpecificVersion As Boolean

Dim instance As Reference3
Dim value As Boolean

value = instance.SpecificVersion

instance.SpecificVersion = value
bool SpecificVersion { get; set; }
property bool SpecificVersion {
    bool get ();
    void set (bool value);
}
function get SpecificVersion () : boolean
function set SpecificVersion (value : boolean)

Eigenschaftenwert

Typ: System.Boolean

Ein boolean-Wert, der angibt, ob nur eine bestimmte Version des Verweises verwendet wird.

Hinweise

Diese Eigenschaft ermöglicht es Ihnen, eine bestimmte Version eines Verweises auf eine Assembly für ein Projekt als Ziel zu verwenden.

Beispiele

In diesem Beispiel wird der SpecificVersion-Wert für jeden Verweis in einem geöffneten Visual Basic-, Visual C#- oder Visual J#-Projekt angezeigt. Um dieses Beispiel als Add-In auszuführen, informieren Sie sich unter Gewusst wie: Kompilieren und Ausführen der Codebeispiele für das Automatisierungsobjektmodell.

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)
    DisplaySpecificVersionValue(applicationObject)
End Sub
Public Sub DisplaySpecificVersionValue(ByVal dte As DTE2)
    ' The first project is a Visual Basic, C#, or J# project.
    Dim vsProject As VSProject2 =_
    CType(applicationObject.Solution.Projects.Item(1).Object, _
    VSProject2)
    Dim aRef As Reference3
    Dim refStr As String
    refStr = ""
    For Each aRef In vsProject.References
        refStr += (aRef.Name & " has a specific version value of: " _
        & aRef.SpecificVersion.ToString() & vbCr & vbCr)
    Next
    MsgBox(refStr)
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;
    DisplaySpecificVersionValue(((DTE2)applicationObject));
}
public void DisplaySpecificVersionValue(DTE2 dte)
{
    // The first project is a Visual Basic, C#, or J# project.
    VSProject2 aProject = 
((VSProject2)(applicationObject.Solution.Projects.Item(1).Object));
    Reference3 aRef = null;
    string refStr = null;
    refStr = "";
    foreach (VSLangProj80.Reference3 temp in aProject.References)
    {
        aRef = temp; 
        refStr += (aRef.Name + " has a specific version value of: " 
+aRef.SpecificVersion.ToString() + "\n" + "\n");
    }
    MessageBox.Show(refStr);
}

Berechtigungen

Siehe auch

Referenz

Reference3-Schnittstelle

Reference3-Member

VSLangProj80-Namespace