IVsSolution2.GetProjectOfProjref Method
Returns a hierarchy for the specified project reference string.
Namespace: Microsoft.VisualStudio.Shell.Interop
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
Syntax
'Declaration
Function GetProjectOfProjref ( _
pszProjref As String, _
<OutAttribute> ByRef ppHierarchy As IVsHierarchy, _
<OutAttribute> ByRef pbstrUpdatedProjref As String, _
<OutAttribute> puprUpdateReason As VSUPDATEPROJREFREASON() _
) As Integer
int GetProjectOfProjref(
string pszProjref,
out IVsHierarchy ppHierarchy,
out string pbstrUpdatedProjref,
VSUPDATEPROJREFREASON[] puprUpdateReason
)
int GetProjectOfProjref(
[InAttribute] String^ pszProjref,
[OutAttribute] IVsHierarchy^% ppHierarchy,
[OutAttribute] String^% pbstrUpdatedProjref,
[OutAttribute] array<VSUPDATEPROJREFREASON>^ puprUpdateReason
)
abstract GetProjectOfProjref :
pszProjref:string *
ppHierarchy:IVsHierarchy byref *
pbstrUpdatedProjref:string byref *
puprUpdateReason:VSUPDATEPROJREFREASON[] byref -> int
function GetProjectOfProjref(
pszProjref : String,
ppHierarchy : IVsHierarchy,
pbstrUpdatedProjref : String,
puprUpdateReason : VSUPDATEPROJREFREASON[]
) : int
Parameters
pszProjref
Type: System.String[in] Pointer to the existing project reference string, if applicable. Can be nulla null reference (Nothing in Visual Basic).
ppHierarchy
Type: Microsoft.VisualStudio.Shell.Interop.IVsHierarchy%[out] Pointer to the IVsHierarchy interface referred to by the project reference.
pbstrUpdatedProjref
Type: System.String%[out] Pointer to the updated project reference string.
puprUpdateReason
Type: array<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.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From vsshell.idl:
HRESULT IVsSolution2::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.
.NET Framework Security
- 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.