Share via


Project system integration with version control - how to *not* control specific files

Controlling state of the files is a bread and butter of the scc provider's work. However from time to time project is referencing file that should not be source controlled. It can be a generated file (like a xap file inside web application projects, or idl generated files inside cpp project) or a common file, which is shared by many other projects. How project creator should mark them as not source controlled? How scc provider will know that? Well, there are two possible solutions, each one with its weaknesses and strengths.

 The first solution, which I favor, is two implement IVsSccProject2.GetSccFiles in a way that it returns success (S_OK) and empty list for the interesting files. Returning success is a key here, because otherwise caller should fall back to GetMKDocument() call. Returning empty list indicates that this node in the hierarchy has no source controlled files associated with it.

The second solution is to use DTE.SourceControl.ExcludeItem. This solution is much simpler than the first one - we don't need to complicate implementation of the GetSccFiles after all. However It comes with a price:

- calling ExcludeItem will cause scc provider to be loaded. This maybe a noticeable delay when you create first project in a Visual Studio session

- format in which excluded items are stored is not standardized. If you create project with one scc provider being active and you change provider, the file will not be excluded any more. This is not true between VSS and TFS, just because they both use vspscc file format.

- ExcludeItem does not work for websites. In case of both VSS and TFS we store excluded items in a hint file. Websites don't have project files, so keeping hint files would be much more complicated.

I hope that this description will let you make the right design decision in the future!