c# - How can I programmatically check-out an item for edit in TFS? -
i'm working on utility processing files being under source control using tfs 2010.
if item not yet checked-out edit, i'm getting exception, predictable because file in read-only mode.
what ways exist check-out file?
p.s. want programmatic rather process.start("tf.exe", "...");
if that's applicable.
some of other approaches mentioned here work versions of tfs or make use of obsolete methods. if receiving 404, approach using not compatible server version.
this approach works on 2005, 2008, , 2010. don't use tfs longer, haven't tested 2013.
var workspaceinfo = workstation.current.getlocalworkspaceinfo(filename); using (var server = new tfsteamprojectcollection(workspaceinfo.serveruri)) { var workspace = workspaceinfo.getworkspace(server); workspace.pendedit(filename); }
Comments
Post a Comment