Export (0) Print
Expand All

Source Control Plug-in Sample

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 shows how to create a basic source control plug-in for the Visual Studio integrated development environment (IDE).

NoteNote

The procedure below assumes that the sample is installed in the default location: <drive>:\Program Files\Visual Studio 2005 SDK\<build number>\VisualStudioIntegration\Unsupported\MSSCCI.

This sample directory contains the following files:

File Description

Readme.txt

Brief instructions of how to register the sample.

SampleMSSCCI.h

Empty header file.

SampleMSSCCI.cpp

Skeleton implementation of functions.

SampleMSSCCI.sln

Solution file for this sample.

SampleMSSCCI.vcproj

Project file for this sample.

scc.h

Contains the prototypes and definitions for Source Code Control APIs.

stdafx.cpp

Used for building the precompiled header.

stdafx.h

Used for building the precompiled header.

This sample demonstrates:

  • Building a source control plug-in as a DLL and creating an entry point for the plug-in.

  • A nonfunctional implementation of the essential source control functions (only SccGetVersion, SccInitialize, and SccUninitialize do any real work). However, you can put breakpoints on the various functions to see when they get called.

  • Verification that the Visual Studio IDE can locate the source control plug-in created by the sample and can call it effectively in response to common source control operations requested by the user.

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 this sample

  1. Open the solution file, SampleMSSCCI.sln, in the Visual Studio IDE.

  2. Build the solution.

  3. Modify the following entries in the registry to make your MSSCCI provider available in Visual Studio.

    1. Update the SCCServerPath to set the path to your sample source control DLL. A full path to the DLL on the local disk must be used. For security reasons, Visual Studio will not load MSSCCI providers registered with relative paths or pointing to a DLL on network shares. Replace "Your Company" and "Your Product" with appropriate company and product names.

      HKEY_LOCAL_MACHINE\
        SOFTWARE\
          SourceCodeControlProvider\
            InstalledSCCProviders\
              MSSCCI Sample=sz:"Software\Your Company\Your Product
      
      HKEY_LOCAL_MACHINE\
        SOFTWARE\
          Your Company\
            Your Product\
              SCCServerName=sz:"MSSCCI Sample"
              SCCServerPath=sz:"C:\Program Files\VSIP 8.0\MSSCCI\Release\SampleMSSCCI.dll"
      
    2. Determine if the user wants to register your MSSCCI provider as a primary provider and replace the MSSCCI provider that is already registered. Update the ProviderRegKey entry as follows:

      HKEY_LOCAL_MACHINE\
        SOFTWARE\
          SourceCodeControlProvider\
            ProviderRegKey=sz:"Software\Your Company\Your Product"
      
      HKEY_LOCAL_MACHINE\
        SOFTWARE\
          Microsoft\
            VisualStudio\
              8.0\
                CurrentSourceControlProvider
                  @=sz:"{53544C4D-FFD5-48A9-B04A-0700CCD31070}"
                  ProviderRegKey=sz:"Software\Your Company\Your Product"
      
      Caution noteCaution

      The change above replaces or overrides the existing Visual SourceSafe registration. Record the contents of these two entries and restore them when you are finished running the sample.

  4. After the sample is built and registered, test it from the Visual Studio IDE by invoking the various source control operations as the user.

    Refer to the Test Guide for Source Control Plug-ins for an overview of areas to test in your actual source control plug-in. In the sample, invoking each function checks only for the presence of an implementation of the appropriate functions with the correct syntax. The sample functions are meant to simply return SCC_OK on invocation.

    NoteNote

    To prevent Visual Studio from refusing to load your plug-in as you develop it and add capabilities, the best approach is to implement all the functions and capabilities specified in the scc.h header file. However, a temporary workaround is to set registry entries. The "WarnedOldMSSCCIProvider" entry decrements each time you restart Visual Studio, so you must reset the value to 500 after you have restarted Visual Studio 500 times. For example:

    HKEY_CURRENT_USER\
      Software\
        Microsoft\
          VisualStudio\
            8.0\
              SourceControl\
                WarnedOldMSSCCIProvider=dword:00000500
                UseOldSCC=dword:00000001
    
    NoteNote

    To load your MSSCCI provider in the Microsoft Visual Studio Experimental build, repeat the steps above using the 8.0Exp entry instead of 8.0 in the registry key:

    HKEY_CURRENT_USER\
      Software\
        Microsoft\
          VisualStudio\
            8.0Exp\
              SourceControl\
    

Requirements

The hardware and operating system requirements for adding a source control plug-in are the same as those for Visual Studio. Visual Studio .NET 2002, Visual Studio .NET 2003, or Visual Studio 2005 is required. For more information, see How to: Install a Source Control Plug-in. It contains a table that shows which version of the Source Code Control API works with which version of Visual Studio.

NoteNote

In Visual Studio 2005, the active source control plug-in can be set for each user, not just the machine in general. Although the machine will still retain a currently registered source control plug-in, it can be overridden on a per-user basis. Registering a source control plug-in remains the same: Visual Studio uses that information to manage the plug-ins for each user.

Concepts

Overview of Source Control Integration

Provides a brief overview of source control technology.

Source Control Plug-in Architecture

Uses an architecture diagram to explain how the source control plug-in integrates with the Visual Studio IDE.

Reference

Source Control Plug-ins

Provides a complete listing of the elements that constitute the Source Control Plug-in API.

Test Guide for Source Control Plug-ins

Provides guidance about testing the installation and operation of the source control plug-in.

See Also

Community Additions

ADD
Show:
© 2014 Microsoft