This documentation is archived and is not being maintained.

Basic Source Code Control Provider Sample (C#)

Visual Studio 2005
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This sample demonstrates how to create the basic structure and functionality for a source code control provider. It is a VSPackage that registers with Visual Studio and can be used as an active source code control provider.

Some of the goals of source code control, or source control or SCC for short, are version control, exclusive file access, cross-project collaboration, and file sharing in projects. Most source control applications enable:

  • Setting user and file access permissions.

  • Checking project items in and out.

  • Automatically archiving each revision of a document.

The sample shows you how to:

  • Implement a SCC provider VSPackage and create, activate, and deactivate the SCC provider service.

  • Display a custom Options page when your SCC provider is active.

  • Display a custom tool window when your SCC provider is active.

  • Display custom menu items when your SCC provider is active.

The sample does not demonstrate how to implement actual source control features; those features are demonstrated in the more full-featured Source Code Control Provider Sample (C#). For more information, see Source Control (Visual Studio SDK).

Security noteSecurity Note

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

  1. Open the BasicSccProvider.sln solution.

    The default location for this is <drive>:\Program Files\Visual Studio 2005 SDK\<build number>\VisualStudioIntegration\Samples\SourceControl\CSharp\Example.BasicSccProvider.


    Included at this location is Overview.xml, which provides more details about this sample.

  2. Press F5 to build the sample, register it in the experimental hive, and launch Visual Studio from the experimental hive.

To see the sample's functionality

  1. On the Tools menu, click Options to display the Options dialog box.

  2. In the Options dialog box, click Plug-in Selection under the Source Control node.

  3. On the Plug-in Selection page, in the Current source control plug-in list, select Managed Source Control Sample Basic Provider.

    This makes your custom SCC provider the SCC provider for all solutions in Visual Studio.

    Notice that when you select your custom SCC provider, a new custom option page named Sample Options Page Basic Provider displays under the Source Control node. In a real-world source control application, this page would contain the application settings.

  4. Click OK.

    A new custom tool window named Sample Source Control Provider ToolWindow displays. In addition to the tool window, an empty command named Scc Command is added on the Tools menu.

    Because this sample is only for demonstration, clicking the new tool window's toolbar button only toggles the background color. A full-featured SCC provider would contain more useful toolbar buttons and commands.


See Also