Reference3.AutoReferenced Eigenschaft

Definition

Ruft ab, ob vom Compiler automatisch auf den Verweis verwiesen wird.

public:
 property bool AutoReferenced { bool get(); };
public:
 property bool AutoReferenced { bool get(); };
[System.Runtime.InteropServices.DispId(125)]
public bool AutoReferenced { [System.Runtime.InteropServices.DispId(125)] get; }
[<System.Runtime.InteropServices.DispId(125)>]
[<get: System.Runtime.InteropServices.DispId(125)>]
member this.AutoReferenced : bool
Public ReadOnly Property AutoReferenced As Boolean

Eigenschaftswert

Boolean

Ein boolescher Wert, der angibt, ob auf den Verweis automatisch verwiesen wird.

Attribute

Beispiele

In diesem Beispiel werden die Verweise in einem geöffneten-oder-Projekt durchlaufen Visual Basic Visual C# . Anschließend wird ermittelt, ob es sich um einen automatischen Verweis handelt. Informationen zum Ausführen dieses Beispiels als Add-in finden Sie unter Gewusst wie: Kompilieren und Ausführen der Code Beispiele für das Automatisierungs Objektmodell.

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)  
    DisplayAutoReferenced(applicationObject)  
End Sub  
Public Sub DisplayAutoReferenced(ByVal dte As DTE2)  
    ' The first project is a Visual Basic or C# 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 an AutoReferenced value of: " _  
        & aRef.AutoReferenced.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;  
    DisplayAutoReferenced(((DTE2)applicationObject));  
}  
public void DisplayAutoReferenced(DTE2 dte)  
{  
    // The first project is a Visual Basic or C# 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 an AutoReferenced value of : "   
+ aRef.AutoReferenced.ToString() + "\n" + "\n");  
    }  
    MessageBox.Show(refStr);  
}  

Hinweise

Einige Verweise werden vom Compiler automatisch verwendet. Beispielsweise verweisen Visual Basic Projekte automatisch auf MSCORLIB.dll und Microsoft.VisualBasic.dll.

Gilt für