Compartir a través de


IVsSolutionBuildManager.GetProjectDependencies Method

Definition

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

int GetProjectDependencies(Microsoft::VisualStudio::Shell::Interop::IVsHierarchy const & pHier, unsigned int celt, std::Array <Microsoft::VisualStudio::Shell::Interop::IVsHierarchy const &> const & rgpHier, std::Array <unsigned int> const & pcActual);
public int GetProjectDependencies (Microsoft.VisualStudio.Shell.Interop.IVsHierarchy pHier, uint celt, Microsoft.VisualStudio.Shell.Interop.IVsHierarchy[] rgpHier, uint[] pcActual);
abstract member GetProjectDependencies : Microsoft.VisualStudio.Shell.Interop.IVsHierarchy * uint32 * Microsoft.VisualStudio.Shell.Interop.IVsHierarchy[] * uint32[] -> int
Public Function GetProjectDependencies (pHier As IVsHierarchy, celt As UInteger, rgpHier As IVsHierarchy(), Optional pcActual As UInteger()) As Integer

Parameters

pHier
IVsHierarchy

[in] Pointer to an IVsHierarchy object.

celt
UInt32

[in] Specifies celt.

rgpHier
IVsHierarchy[]

[in, out] Specifies projects to build.

pcActual
UInt32[]

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

Returns

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsSolutionBuildManager::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 = null, 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 = pIVsSolutionBuildManager->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 = pIVsSolutionBuildManager->GetProjectDependencies(pHier, ulActual, rgpIVsHierarchy, &ulActual2);

// use the pointers here

// release the hier pointers

// release the memory

::CoTaskMemFree(rgpIVsHierarchy);

Applies to