Returns a hierarchy for the specified project reference string.
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
int GetProjectOfProjref( string pszProjref, out IVsHierarchy ppHierarchy, out string pbstrUpdatedProjref, VSUPDATEPROJREFREASON puprUpdateReason )
- Type: System.String
[in] Pointer to the existing project reference string, if applicable. Can be null.
- Type: Microsoft.VisualStudio.Shell.Interop.IVsHierarchy
[out] Pointer to the IVsHierarchy interface referred to by the project reference.
- Type: System.String
[out] Pointer to the updated project reference string.
- Type: Microsoft.VisualStudio.Shell.Interop.VSUPDATEPROJREFREASON
[out] Identified describing the reason for the change in the project reference string. For a list of puprUpdateReason values, see VSUPDATEPROJREFREASON.
HRESULT IVsSolution::GetProjectOfProjref( [in] LPCOLESTR pszProjref, [out] IVsHierarchy **ppHierarchy, [out] BSTR *pbstrUpdatedProjref, [out] VSUPDATEPROJREFREASON *puprUpdateReason );
There are two scenarios for this method:
The project reference tracks when the project is renamed within one solution. When attempting to bind a project reference, the project GUID is first attempted by calling GetProjectOfGuid. If this call succeeds and the project has been renamed, then the updated project reference is also provided for the client.
Projects are added to a new solution, and the project reference is still able to bind. If the GUID fails to bind, then an attempt is made to locate the project by using the type/name information. If this succeeds, then an updated project reference that includes the new project is returned.
The contents of the project reference are opaque to the client. However, in order to support these two scenarios for our internal implementation, we need to have a project reference string that is composed of the following information:
Project GUID assigned and maintained by the solution file
Project type (or name)
The following is a description of how the GetProjectOfProjref method is used to support drag-and-drop operations:
The CF_VSPROJECTITEMS and CF_VSPROJECTS clipboard formats use the DROPFILES structure in the same manner as CF_HDROP or CF_PRINTERS. The data that follows the DROPFILES structure is a double-NULL-terminated list of Projref strings. The consumer of the drop operation can use the Windows API DragQueryFile to examine the data in the DROPFILES structure. CF_VSPROJECTS format is offered when the Projref strings identify projects as a whole, that is, *pitemid == VSITEMID_ROOT. The CF_VSPROJECTITEMS format is offered when the Projref strings identify one or more individual project items. Either CF_VSPROJECTS or CF_VSPROJECTITEMS should be offered, but never both.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.