다음을 통해 공유


IVsSolution.GetProjectOfProjref Method

Definition

Returns a hierarchy for the specified project reference string.

public:
 int GetProjectOfProjref(System::String ^ pszProjref, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsHierarchy ^ % ppHierarchy, [Runtime::InteropServices::Out] System::String ^ % pbstrUpdatedProjref, cli::array <Microsoft::VisualStudio::Shell::Interop::VSUPDATEPROJREFREASON> ^ puprUpdateReason);
int GetProjectOfProjref(std::wstring const & pszProjref, [Runtime::InteropServices::Out] Microsoft::VisualStudio::Shell::Interop::IVsHierarchy const & & ppHierarchy, [Runtime::InteropServices::Out] std::wstring const & & pbstrUpdatedProjref, std::Array <Microsoft::VisualStudio::Shell::Interop::VSUPDATEPROJREFREASON> const & puprUpdateReason);
public int GetProjectOfProjref (string pszProjref, out Microsoft.VisualStudio.Shell.Interop.IVsHierarchy ppHierarchy, out string pbstrUpdatedProjref, Microsoft.VisualStudio.Shell.Interop.VSUPDATEPROJREFREASON[] puprUpdateReason);
abstract member GetProjectOfProjref : string * IVsHierarchy * string * Microsoft.VisualStudio.Shell.Interop.VSUPDATEPROJREFREASON[] -> int
Public Function GetProjectOfProjref (pszProjref As String, ByRef ppHierarchy As IVsHierarchy, ByRef pbstrUpdatedProjref As String, puprUpdateReason As VSUPDATEPROJREFREASON()) As Integer

Parameters

pszProjref
String

[in] Pointer to the existing project reference string, if applicable. Can be null.

ppHierarchy
IVsHierarchy

[out] Pointer to the IVsHierarchy interface referred to by the project reference.

pbstrUpdatedProjref
String

[out] Pointer to the updated project reference string.

puprUpdateReason
VSUPDATEPROJREFREASON[]

[out] Identified describing the reason for the change in the project reference string. For a list of puprUpdateReason values, see VSUPDATEPROJREFREASON.

Returns

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

Remarks

COM Signature

From vsshell.idl:

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.

Applies to