VSProject.References プロパティ
更新 : 2007 年 11 月
プロジェクトの References コレクションを取得します。読み取り専用です。
名前空間 : VSLangProj
アセンブリ : VSLangProj (VSLangProj.dll 内)
構文
'宣言
ReadOnly Property References As References
'使用
Dim instance As VSProject
Dim value As References
value = instance.References
References References { get; }
property References^ References {
References^ get ();
}
function get References () : References
プロパティ値
参照を表す Reference オブジェクトを含む References コレクションを返します。
解説
外部コンポーネントを使用するためにコードを記述する場合は、あらかじめプロジェクトにそのコンポーネントへの参照を追加しておく必要があります。参照の対象にできるコンポーネントは、.NET アセンブリ、COM オートメーションのサーバーとコントロール、コンポーネントを公開している同じソリューション内の他のプロジェクトの 3 種類です。
例
' Macro Editor
' Assuming that the first project in the solution is a Visual Basic or C#
' application, this routine lists the references in the project.
Imports VSLangProj
Sub ListReferences()
' Retrieve the VSProject object.
Dim theVSProject As VSProject = _
CType(DTE.Solution.Projects.Item(1).Object, VSProject)
' Retrieve the references collection.
Dim refs As References = theVSProject.References
' Create a string list of the reference names.
Dim refList As String = ""
Dim aRef As Reference
For Each aRef In refs
refList &= aRef.Identity & ControlChars.CrLf
Next
MsgBox(refList)
End Sub
アクセス許可
- 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。