SourceSafe 2005 automation
Hi I'm having some trouble, when using
my existing VSS automation code when
upgrading to VSS 2005 B2.
The problem is when i e.g. whants to get
the latest revision of a file to a directory
that is different from the Working Directory
of the file using the VSSItem.Get() method.
VSS_Item.Get(
ref LocalPath, Flags);I.e. The LocalPath differs from "" or null.
The automation samples provided by Microsoft shows
the same behaviour as my code - the file is not
copied to the LocalPath destination - but no error
is reported by the API !
Is there anything changed in the SSAPI.DLL e.g.
new required Flags ?
Best regards Bingster
[763 byte] By [
BingMPI] at [2008-1-7]
Hi Bingster,With latest VSS 6.0d QFE drops and with VS2005 drops you have to explicitly pass in the VSSFLAG_FORCEDIRNO flag for Get() Flags, otherwise the item will be get in the current working folder. Here is a VB sample:
Dim x As New SourceSafeTypeLib.VSSDatabase
x.Open("\\alinc00\vss$")
Dim y As SourceSafeTypeLib.VSSItem
y = x.VSSItem("$/x.txt")
Dim s As String
s = "c:\temp\ssapi\x1.txt" 'Note: when getting a file, this has to be the destination filename, not a folder.
'y.Get(s, SourceSafeTypeLib.VSSFlags.VSSFLAG_REPREPLACE) -> this will get the item as C:\temp\x.txt (C:\temp is the working folder for $/)
y.Get(s, SourceSafeTypeLib.VSSFlags.VSSFLAG_REPREPLACE + SourceSafeTypeLib.VSSFlags.VSSFLAG_FORCEDIRNO) 'this gets the item as specified in s string
Alin
There is no SourceSafeTypeLib.dll
If you use VSS 6.0, you need to right click the project, AddReference... and Browse on disk to ssapi.dll from SourceSafe\Win32 folder.
If you use VSS 2005 you can use directly the SourceSafe Interop by adding a reference to
Microsoft.VisualStudio.SourceSafe.Interop (in the .NET tab of AddReference... dialog)
Alin
hi,
this code is good but i want to take on checkedlistbox only special files to special directory.
this is possible ?
eg;
m_db.Open(@"\\VssTest\srcsafe.ini", "admin", "");
vssFile = m_db.get_VSSItem("$/CSharp/Test/", false);
foreach (IVSSVersion vssVersion in vssFile.get_Versions(0))
if (vssVersion.Username == "Admin")
m_checkedListBoxSource.Items.Add(new VssInfo(vssVersion.VersionNumber, vssFile.Name, vssVersion.Username, vssVersion.Date, vssFile.Spec));
.
.
.
button_click event:
if (m_checkedListBoxWebFiles.SelectedIndex == -1)
return;
VssInfo v = (VssInfo)m_checkedListBoxSource.Items[m_checkedListBoxSource.SelectedIndex];
so i dont know how do this part ?
could u help me this situation?