Reference.Services Sample (C#)
The Reference.Services C# sample demonstrates:
Providing a global service available to another VSPackage.
Providing a local service available only to the VSPackage implementing it.
Handling service requests.
This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.
To build and run the sample
Open the Reference.Services.sln solution.
The default location is <drive>:\Program Files\Visual Studio 2005 SDK\<build number>\VisualStudioIntegration\Samples\IDE\CSharp\Reference.Services.
This sample includes an overview document with detailed implementation notes. To open it, right-click Overview.xml and click View in Browser.
Press F5 to build the sample, register it in the experimental hive, and start Visual Studio from the experimental hive.
To see the sample's functionality
On the Tools menu, click Get C# Global Service.
A message is displayed in the Output window indicating that the global service was consumed.
On the Tools menu, click Get C# Local Service.
A message is displayed in the Output window indicating that a test succeeded. The test guarantees that the client VSPackage failed to consume a local service on another VSPackage. This illustrates that the service provider passed to a VSPackage by Visual Studio cannot be used to consume local services.
On the Tools menu, click Get C# Local using Global Service.
A message is displayed in the Output window indicating that the local service was consumed by a method on the global service.