VCProject.CanAddProjectReference - метод
Returns whether it is okay to add the given project reference
Пространство имен: Microsoft.VisualStudio.VCProjectEngine
Сборка: Microsoft.VisualStudio.VCProjectEngine (в Microsoft.VisualStudio.VCProjectEngine.dll)
Синтаксис
'Декларация
Function CanAddProjectReference ( _
proj As Object _
) As Boolean
'Применение
Dim instance As VCProject
Dim proj As Object
Dim returnValue As Boolean
returnValue = instance.CanAddProjectReference(proj)
bool CanAddProjectReference(
Object proj
)
bool CanAddProjectReference(
[InAttribute] Object^ proj
)
function CanAddProjectReference(
proj : Object
) : boolean
Параметры
proj
Тип: System.ObjectThe project reference.
Возвращаемое значение
Тип: System.Boolean
true if it is okay to add the given project reference; otherwise, false.
Заметки
This method is generally used in conjunction with the AddProjectReference method. You use this method to determine whether it is okay to add a project reference, and if it is, then you call AddProjectReference.
Примеры
See How to: Compile Example Code for Visual C++ Code Model Extensibility for information about how to compile and run this example.
CanAddProjectReference adds a second project as a reference to the first project, if possible.
' Add a reference to Microsoft.VisualStudio.VCProjectEngine and have
' two Visual C++ projects loaded before running this example.
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine
Public Module Module1
Sub Test()
Dim prj1, prj2 As VCProject
prj1 = DTE.Solution.Projects.Item(1).Object
prj2 = DTE.Solution.Projects.Item(2).Object
' Adds project 2 as a reference to project 1.
If prj1.CanAddProjectReference(prj2) Then
prj1.AddProjectReference(prj2)
End If
End Sub
End Module
Разрешения
- Полное доверие для непосредственно вызывающего метода. Этот член не может быть использован частично доверенным кодом. Дополнительные сведения см. в разделе Using Libraries from Partially Trusted Code.