IVsProjectStartupServices::AddStartupService Method (Guid)

 

Adds third party service to the list of services to be started when the project is instantiated and ensures that all third party services are started.

Namespace:   Microsoft.VisualStudio.Shell.Interop
Assembly:  Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)

int AddStartupService(
	[InAttribute] Guid% guidService
)

Parameters

guidService
Type: System::Guid

[in] GUID object specifying service.

Return Value

Type: System::Int32

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

From vsshell.idl:

HRESULT IVsProjectStartupServices::AddStartupService(
   [in] REFGUID guidService
);

Your implementation of IVsProjectStartupServices.AddStartupService stores the service GUID, then starts it and maintains a pointer to it. You must store any added GUIDs in your project file and read them back in and start the services during project initialization. When your project hierarchy class terminates, you must stop the services, which is accomplished by implementing RemoveStartupService to release the pointers you held.

This functionality is not provided in HierUtil7's CVsHierarchy, which is the basis for 's CMyProjectHierarchy, so the interface is implemented in the sample. The implementation of the above behavior in is contained within a member variable to the hierarchy (m_projectStartupServices), which adds the code it takes to remember the services, and start/stop them. The m_projectStartupServices class member is implemented in CVsProjectStartupServices in the file VsProjectStartupServices.h/.cpp, which you can analyze to get an example of proper implementation.385fd2a3-d9f1-4808-87c2-a3f05a91fc36385fd2a3-d9f1-4808-87c2-a3f05a91fc36385fd2a3-d9f1-4808-87c2-a3f05a91fc36

null GUIDS are not added to the list.

Return to top
Show: