Programmatically Delete Folder/Branch
-
2012年4月5日 下午 10:02
Hello,
I've been searching around for an example of how to use the TFS 2010 API to delete a branch and/or folder and have come up empty.
Any example I've found involves shelling out to tf.exe which I want to avoid like the plague. Any help is greatly appreciated!
Thank you,
Marshall
所有回覆
-
2012年4月6日 上午 08:56
Create a ChangeSet object: http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.changeset.aspx
Associate a list of changes for the files you want to delete: http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.change.aspx
Set the Change.ChangeType to Delete: http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.changetype.aspx
Call ChangeSet.Update.
My blog: blog.jessehouwing.nl
- 已提議為解答 Trevor HancockMicrosoft Employee, Moderator 2012年4月6日 下午 04:43
- 已標示為解答 Trevor HancockMicrosoft Employee, Moderator 2012年4月13日 下午 03:15
-
2012年4月6日 下午 05:42
Thanks Jesse.
How do I create an instance of a Changeset given there are no public constructors? I searched online for this for about 30 minutes without any success.
Marshall
-
2012年4月6日 下午 09:21
Sorry was a little too early in my answer. That's how you get the information for already committed changes. To actually make a change, use the VersionControlServer class to get a Workspace (create a new one, or get an existing one). The workspace has a PendAdd/PendDestroy/PendDelete/PendMerge etc method to create pending changes in the workspace. Then use the Workspace.Checkin method to commit them to source control.
My blog: blog.jessehouwing.nl
- 已提議為解答 Trevor HancockMicrosoft Employee, Moderator 2012年4月9日 下午 06:40
- 已標示為解答 Trevor HancockMicrosoft Employee, Moderator 2012年4月13日 下午 03:15

