Tuesday, September 25, 2007

Implementing custom source control glyphs for VSIP scc providers

It's the second time in the last month when someone asked me how to implement correctly the IVsSccGlyphs.GetCustomGlyphList function in their source control provider so they can expose custom source control glyphs.

So, this time I though I should implement the function myself and see what's going on...

Of course, on first try I've hit the same problems reported by the customers :-). It turned out quickly that the problems come either from not setting up correctly the image size in the imagelist, from not setting correctly the transparency color, or not declaring the interface on the correct service.

If you're interested, I've put the sample for download on my website: Visual Studio Source Control Provider with Custom Glyphs.

The sample is based on the SccProvider sample in VisualStudio SDK, so you can Windiff the 2 solutions and easily see the code additions.

Here is how to test the new code:
1. Build the solution in VS2005 and run it.
2. In Tools/Options set the Sample Source Control Provider as the active provider (at this point the shell should call you on IVsSccGlyphs.GetCustomGlyphList to get the custom glyphs suported by your scc provider).
3. Create a new solution, e.g. a ConsoleApplication C# project.
4. Add the solution to source control
5. Add a new file to the project or to the solution
6. The new file should appear in SolutionExplorer with the new "pending add" icon exposed by the package, like in the picture below.

Custom glyph exposed by the sample scc provider

1 comment:

cmaxo said...

Awesome! Thanks for the sample. It worked the first time.