Compartir a través de


IVsSolutionBuildManager2.GetProjectDependencies Method

Returns a list of projects that the given hierarchy depends on.

Namespace:  Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

Syntax

'Declaration
Function GetProjectDependencies ( _
    pHier As IVsHierarchy, _
    celt As UInteger, _
    <OutAttribute> rgpHier As IVsHierarchy(), _
    <OutAttribute> pcActual As UInteger() _
) As Integer
int GetProjectDependencies(
    IVsHierarchy pHier,
    uint celt,
    IVsHierarchy[] rgpHier,
    uint[] pcActual
)
int GetProjectDependencies(
    [InAttribute] IVsHierarchy^ pHier, 
    [InAttribute] unsigned int celt, 
    [OutAttribute] array<IVsHierarchy^>^ rgpHier, 
    [OutAttribute] array<unsigned int>^ pcActual
)
abstract GetProjectDependencies : 
        pHier:IVsHierarchy * 
        celt:uint32 * 
        rgpHier:IVsHierarchy[] byref * 
        pcActual:uint32[] byref -> int
function GetProjectDependencies(
    pHier : IVsHierarchy, 
    celt : uint, 
    rgpHier : IVsHierarchy[], 
    pcActual : uint[]
) : int

Parameters

  • celt
    Type: UInt32

    [in] Specifies celt.

  • pcActual
    Type: array<UInt32[]

    [out, optional] Pointer to the number of projects.

Return Value

Type: Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsSolutionBuildManager2::GetProjectDependencies(
   [in] IVsHierarchy *pHier,
   [in] ULONG celt,
   [in, out, size_is(celt)] IVsHierarchy *rgpHier[],
   [out, optional] ULONG *pcActual
);

Returns a list of projects that the given hierarchy depends on.

You should call CalculateProjectDependencies prior to calling GetProjectDependencies if you are unsure if the dependencies are up to date at the point of the call. CalculateProjectDependencies will force project dependencies to be recalculated.

This method should be called twice, the first time with celt = 0 and rgpHier = nulla null reference (Nothing in Visual Basic), to get the size in pcActual, then a second time after allocating the list to get the projects.

The method will be implemented as follows (error checks are omitted):

ULONG ulActual;

hr = pIVsSolutionBuildManager2->GetProjectDependencies(pHier, 0, NULL, &ulActual)

// allocate memory to hold the hierarchy pointers

IVsHierarchy** rgpIVsHierarchy = (IVsHierarchy**) ::CoTaskMemAlloc(ulActual * sizeof(IVsHierarchy *));

memset(rgpIVsHierarchy, 0, sizeof(IVsHierarchy*)*ulActual);

// now get the hierarchy pointers

ULONG ulActual2;

hr = pIVsSolutionBuildManager2->GetProjectDependencies(pHier, ulActual, rgpIVsHierarchy, &ulActual2);

// use the pointers here

// release the hier pointers

// release the memory

::CoTaskMemFree(rgpIVsHierarchy);

.NET Framework Security

See Also

Reference

IVsSolutionBuildManager2 Interface

Microsoft.VisualStudio.Shell.Interop Namespace