IVsProjectFactory.SetSite 方法

在环境中初始化项目工厂并允许该项目中获取该环境提供的服务。

命名空间:  Microsoft.VisualStudio.Shell.Interop
程序集:  Microsoft.VisualStudio.Shell.Interop(在 Microsoft.VisualStudio.Shell.Interop.dll 中)

语法

声明
Function SetSite ( _
    psp As IServiceProvider _
) As Integer
int SetSite(
    IServiceProvider psp
)

参数

返回值

类型:System.Int32
如果方法成功,则返回 S_OK。如果失败,它会返回一个错误代码。

备注

COM 签名

从 vsshell.idl:

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

该环境与 UnregisterProjectType一起调用此方法。

示例

[C#]

/// <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;
}

在上面的示例 this 引用相关项目的工厂。

.NET Framework 安全性

请参见

参考

IVsProjectFactory 接口

Microsoft.VisualStudio.Shell.Interop 命名空间