IVsProjectFactory.SetSite Method

Initializes the project factory in the environment and allows the project to obtain services proffered by the environment.

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

int SetSite(
	IServiceProvider psp


Type: Microsoft.VisualStudio.OLE.Interop.IServiceProvider
[in] Pointer to the IServiceProvider interface, which can be used by the factory to obtain services proffered by the Visual Studio shell.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

COM Signature

From vsshell.idl:

HRESULT IVsProjectFactory::SetSite(
   [in] IServiceProvider *pSP

The environment calls this method in conjunction with UnregisterProjectType.


/// <summary>
/// Called by the shell to initialize the project factory.
/// </summary>
/// <param name="serviceProvider">An object that is used to find services proffered by the shell.</param>
public virtual void SetSite(Microsoft.OLE.Interop.IServiceProvider serviceProvider)
this.serviceProvider = serviceProvider;

In the example above this refers to the project factory in question.

Community Additions