贴上我自己封装过的,看看有没有帮助using System;namespace VSSDotNet
{
/// <summary>
/// Summary description for VSSDatabase.
/// </summary>
public class VSSDatabase
{
private SourceSafeTypeLib.VSSDatabaseClass m_vssDatabase;
private bool opened=false;
public VSSDatabase()
{
//
// TODO: Add constructor logic here
//
this.m_vssDatabase=new SourceSafeTypeLib.VSSDatabaseClass();
} public void Open(string ssini,string userName,string password)
{
try
{
this.m_vssDatabase.Open(ssini,userName,password);
this.opened=true;
}
catch(System.Runtime.InteropServices.COMException e)
{
throw new LoginException(e.Message);
}
} public void GetVSSItem(VSSItem vssItem,string path,bool deleted)
{
if(this.opened==false)
{
throw new LoginException("You must login VSSDataBase first!");
}
else
{
vssItem.SSTypeItem=this.m_vssDatabase.get_VSSItem(path,deleted);
}
}
} public class LoginException:System.Exception
{
public LoginException()
:base()
{
}
public LoginException(string message)
:base(message)
{
}
public LoginException(string message,Exception innerException)
:base(message,innerException)
{
}
}
}
using System;namespace VSSDotNet
{
/// <summary>
/// Summary description for VSSItem.
/// </summary>
public class VSSItem
{
private SourceSafeTypeLib.VSSItem m_vssItem;
public VSSItem()
{
//
// TODO: Add constructor logic here
//
} public void Get(string localPath,bool recursive)
{
this.m_vssItem.LocalSpec=localPath;
if(recursive==true)
{
this.GetAll(this.m_vssItem);
}
else
{
this.m_vssItem.Get(ref localPath,
(int)SourceSafeTypeLib.VSSFlags.VSSFLAG_GETYES);
}
} protected void GetAll(SourceSafeTypeLib.VSSItem vssItem)
{
string local=vssItem.LocalSpec;
vssItem.Get(ref local,(int)SourceSafeTypeLib.VSSFlags.VSSFLAG_GETYES);
foreach(SourceSafeTypeLib.VSSItem vi in vssItem.get_Items(false))
{
if(vi.Type==(int)SourceSafeTypeLib.VSSItemType.VSSITEM_PROJECT)
{
GetAll(vi);
}
}

} public SourceSafeTypeLib.VSSItem  SSTypeItem
{
get
{
return this.m_vssItem;
}
set
{
this.m_vssItem=value;
}
} }
}