Condividi tramite


Proprietà Reference3.AutoReferenced

Specifica se il compilatore fa automaticamente riferimento al riferimento.

Spazio dei nomi:  VSLangProj80
Assembly:  VSLangProj80 (in VSLangProj80.dll)

Sintassi

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

Valore proprietà

Tipo: System.Boolean
Valore boolean che indica se il riferimento al riferimento è automatico.

Note

Alcuni riferimenti vengono utilizzati automaticamente dal compilatore. I progetti di Visual Basic, ad esempio, fanno automaticamente riferimento a MSCORLIB.dll e a Microsoft.VisualBasic.dll.

Esempi

L'esempio riportato di seguito scorre tutti i riferimenti in un progetto aperto di Visual Basic o Visual C#. Viene quindi stabilito se si tratta di riferimenti automatici. Per eseguire questo esempio come componente aggiuntivo, vedere Procedura: compilare ed eseguire gli esempi di codice del modello a oggetti di automazione.

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);
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Reference3 Interfaccia

Spazio dei nomi VSLangProj80