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) Next
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:
- 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.
- 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?