Sourcesafe Automation Bug

As part of my continuing project in Sourcesafe Automation, I found a weird behavior of the Visual Studio Sourcesafe Interop DLL.

The following code is in Visual Basic 5 which basically connects to a Sourcesafe database and lists all the projects in the root folder of the database.

Dim vssdb As New VSSDatabase
vssdb.Open "<location to sourcesafe srcsafe.ini>", "<username>", "<password>"
Dim xitem As VSSItem
For Each xitem In vssdb.VSSItem(0).Items(False)
   Debug.Print (xitem.Name)

Subsequently, the code equivalent in C# (.NET) , is something that I have blogged before. What I find unusual about the Sourcesafe Interop DLL are the following items:

  1. The “Open” method doesn’t work for the C# version for Sourcesafe .ini files located on a remote location (e.g. \\servername\folder\srcsafe.ini) while the one in the pre .NET environment works well. However, when the location is in the same physical directory as where my website runs, the C# version works well (e.g. vssDb.Open(@”c:\some-directory\srcsafe.ini”, “username”, “password”). A tried a tweak by making the remote location as a mapped network folder but the error is still the same.
  2. In the .NET version, if you placed a bogus file that does not exist in a directory that has a srcsafe.ini (e.g. In vssDb.Open(@”c:\some-directory\srcsafe.ini”, “username”, “password”), you intentionally change “srcsafe.ini” to “srcsafe2.ini”), the system will read the srcsafe.ini in that folder. However, if you specify only the folder or when you remove/rename the “srcsafe.ini” and explicitly change the name in the “Open” method, still that won’t work.

Various searches in Google and other search engines doesn’t work. The closest related result is found here but still the discussion was open-ended. Any suggestions?


One thought on “Sourcesafe Automation Bug

  1. Hi ,
    I have a very urgent requirement of visula sourcesafe 6.0 automation in and 2.0.
    Requirement is : all the items of project level from VSS database should show in treeview control in the leftside of the page and if I will select leftside project folder then in right side it should show all the files with version number,last checkedout by etc.. Please help me with code. thanks in advance.It is very urgent.I am able to login through VSS Database.But making a tree is the time taking factor .

    Prasanta (

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s