This documentation is archived and is not being maintained.

Introduction to Visual SourceSafe Automation 

Visual Studio 2005

IVSS is a collection of COM-based automation interfaces in the Microsoft.VisualStudio.SourceSafe.Interop namespace that Visual SourceSafe exposes to users. It provides functionality both for automating interactions with a Visual SourceSafe database and for responding to database events.

Automating interactions with a Visual SourceSafe database is done through the IVSSDatabase OLE Automation model.

To use this automation model, start with an IVSSDatabase reference and use the Open method to connect to a particular database. After that, use the VSSItem property to retrieve objects that represent SourceSafe projects and files. Those objects reveal further information about themselves via properties and methods that utilize the remainder of the interfaces. For Admin functionality, the IVSSDatabase interface also exposes user information via the IVSSUser and IVSSUsers interfaces. All of these interfaces are IDispatch based.

The second part of IVSS is the event handling mechanism which provides notification events for some (but not all) database operations and is implemented through the use of the following interfaces

Event handling occurs through an add-ins implementation of the various IVSSEvents methods. These are called when any client executes the corresponding action against the database.

An important limitation of the IVSS events is that all of the action occurs on the client side, so each client must have the add-in installed for it to behave properly.

Other Technical Notes

  • The Visual SourceSafe interfaces are apartment threaded. This might impact performance because the calls on multiple threads are serialized.

  • You can make multiple calls that access different databases. However, internally, Visual SourceSafe will actually shut down one database and open another when you switch. This can be quite slow, so it should be done judiciously. In addition, certain restrictions apply. You cannot open another database while you are in the middle of enumerating a history and you cannot open a database from within an event call.

  • The Visual SourceSafe objects are served by an in-process server. The objects cannot be aggregated.

  • Once you create a Visual SourceSafe IVSSItem (file or project) in memory, that object stays in memory until it is released. It may, therefore, become out of date. For instance, if you instantiate an IVSSItem object representing a file, that in-memory item contains the information whether the file is checked out. But if this object is queried an hour later, its information may no longer be correct. So it is not recommended to keep these objects in memory for too long.

  • Similar considerations apply to the IVSSItems collection because it never changes in memory. Even if your code deletes a file, that file will not disappear from the collection.

See Also