共用方式為


Reference3.Resolved 屬性

取得是否已解析目前的參考。

命名空間:  VSLangProj80
組件:  VSLangProj80 (在 VSLangProj80.dll 中)

語法

'宣告
ReadOnly Property Resolved As Boolean
    Get
bool Resolved { get; }
property bool Resolved {
    bool get ();
}
abstract Resolved : bool
function get Resolved () : boolean

屬性值

型別:System.Boolean
如果已解析參考,則為 true,否則為 false。

備註

如需解析參考的詳細資訊,請參閱 Add

範例

此範例會在開啟的 Visual Basic 或 Visual C# 專案中逐一查看參考。 然後會判斷是否已解析這些參考。 若要將此範例當做增益集來執行,請參閱 HOW TO:編譯和執行 Automation 物件模型程式碼範例

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)
    DisplayResolvedStatus(applicationObject)
End Sub
Public Sub DisplayResolvedStatus(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 & " is resolved, or not? : " _
        & aRef.Resolved.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;
    DisplayResolvedStatus(((DTE2)applicationObject));
}
public void DisplayResolvedStatus(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 + " is resolved, or not? : " 
+ aRef.Resolved.ToString() + "\n" + "\n");
    }
    MessageBox.Show(refStr);
}

.NET Framework 安全性

請參閱

參考

Reference3 介面

VSLangProj80 命名空間