How to make a project compatible with VS source control integration

The following are the necessary mininum steps required to integrate a new project type with source control within Visual Studio.

  1. The project must implement Microsoft.VisualStudio.Shell.Interop.IVsSccProject2 (documentation).
    • GetSccFiles - return which files are controllable for the given item ID
    • GetSccSpecialFiles - return hidden files for the given item ID
    • SetSccLocation - persist the SCC settings to the project file
    • SccGlyphChange - notifies project that changes have been made to the indicated items' SCC glyphs
  2. The project must utilize Microsoft.VisualStudio.Shell.Interop.IVsSccManager2 (documentation).
    • RegisterSccProject - call when the project is opened
    • UnregisterSccProject - call when the project is closed
    • GetSccGlyphs - call to get source control glyphs and source control status
  3. The project must utilize Microsoft.VisualStudio.Shell.Interop.IVsQueryEditQuerySave2 (documentation).
    • QueryEditFiles - call before editing a file in the project to notify listeners (e.g. SCC)
    • QuerySaveFiles - call before saving a file in the project to notify listeners (e.g. SCC)
  4. The project must utilize Microsoft.VisualStudio.Shell.Interop.IVsTrackProjectDocuments2 (documentation)
    • OnQuery* - call before attempting the add/rename/move/etc. operation to notify listeners (e.g. SCC) and to give listeners the chance to veto the attempt.
    • OnAfter* - call after the operation has been performed to permit listeners (e.g. SCC) to perform related operations (e.g. pend an SCC add).
  5. To permit SCC commands to show in the context menus, the menu should contain the following groups:
    • guidSHLMainMenu::IDG_VS_CTXT_SOLUTION_SCC
    • guidSHLMainMenu::IDG_VS_CTXT_PROJECT_SCC
    • guidSHLMainMenu::IDG_VS_CTXT_ITEM_SCC