|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Assembly: Microsoft.VisualStudio.Shell.Interop (in microsoft.visualstudio.shell.interop.dll)
[in] Pointer to theInterface through which the VSPackage can query for services.
Return ValueIf the method succeeds, it returns . If it fails, it returns an error code.
This is the most important method in theInterface.
In your implementation of this method, you can:
Load persistent data using the interfacesInterface and Interfaces.
Proffer services, if any.
Register available document factory editors, if any.
Register available project type factories, if any.
Request services that are implemented by other VSPackages
You must have proffered your services by the time these steps are complete. Otherwise, your request for a service may load a VSPackage that requests a service you provide. However, because you have not proffered it yet, the load of the other VSPackage fails, and you cannot gain access to the requested service, possibly causing load failure.
Returning an error result code results in the environment closing the VSPackage and releasing its resources.
In your implementation of this method you should not assume that UI would be available. Do not try to add a pane to Output Window or use any other service that relies on UI to be available. For example, when devenv is invoked with /setup SetSite gets called and the UI is not available.