Registering Services

To support on-demand loading, a service provider must register its global services with Visual Studio.

During development, managed service providers register services by adding attributes to the source code, and then running the RegPkg.exe utility on the resulting assembly. For more information, see How to: Register a Service.

Unmanaged service providers must register the services they provide with Visual Studio in the services section of the system registry. The following .reg file fragment shows how the service, SVsTextManager, might be registered:

[HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\<version number>\Services\{F5E7E71D-1401-11d1-883B-0000F87579D2}]

In the example above, version number is the version of Visual Studio, such as 7.1 or 8.0, the key {F5E7E71D-1401-11d1-883B-0000F87579D2} is the service identifier (SID) of the service, SVsTextManager, and the default value {F5E7E720-1401-11d1-883B-0000F87579D2} is the package GUID of the text manager VSPackage, which provides the service.

Remote Services and Background Threads

Services that you provide are not automatically available remotely or to background threads. To make them available, you must build and register a type library.

From unmanaged code that uses the Visual Studio Library (VSL), you can register your type library this way:

#include <VSLPackageDllEntryPoints.cpp>

From managed code, you can add a post-build step like this:

regasm /tlb MyAssembly.dll

See Also


Service Essentials

Other Resources