共用方式為


IVsRegisterProjectTypes.RegisterProjectType Method

Definition

Registers a project type.

public:
 int RegisterProjectType(Guid % rguidProjType, Microsoft::VisualStudio::Shell::Interop::IVsProjectFactory ^ pVsPF, [Runtime::InteropServices::Out] System::UInt32 % pdwCookie);
public int RegisterProjectType (ref Guid rguidProjType, Microsoft.VisualStudio.Shell.Interop.IVsProjectFactory pVsPF, out uint pdwCookie);
abstract member RegisterProjectType : Guid * Microsoft.VisualStudio.Shell.Interop.IVsProjectFactory * uint32 -> int
Public Function RegisterProjectType (ByRef rguidProjType As Guid, pVsPF As IVsProjectFactory, ByRef pdwCookie As UInteger) As Integer

Parameters

rguidProjType
Guid

[in] Unique identifier of the project type as it appears in the registry.

pVsPF
IVsProjectFactory

[in] Pointer to the IVsProjectFactory interface.

pdwCookie
UInt32

[out] Abstract handle used to retrieve this entry from the environment and to unregister the project type.

Returns

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

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsRegisterProjectTypes::RegisterProjectType(  
   [in] REFGUID rguidProjType,  
   [in] IVsProjectFactory *pVsPF,  
   [out] VSCOOKIE *pdwCookie  
);  

The RegisterProjectType method is called in SetSite method. In SetSite, the package creates its project factory and passes a pointer to the IVsProjectFactory interface to the environment by calling RegisterProjectType.

The environment uses the pointer to create projects from this project type using the CreateProject method.

The environment knows which package to load for a specific project type from the registry data.

Applies to