I'm using the TFS 2010 SDK to programmatically check in edits to files into TFS 2010. The documentation on the TFS 2010 SDK is sparse at best. When I call the method workspace.pendedit() passing in an array of files I want to mark as having a pending edit, nothing is actually checked out. So when I call workspace.checkin() passing in workspace.getpendingchanges and some comments I get an exception that there must be at least one thing that has a pending change (which should be what I passed into pendedit). Any thoughts on why the app isn't marking the files as having a pending edit in the workspace?
A:
Make sure you're doing everything in the right order so TFS knows that the file has changed. You have to:
- Get the file from the workspace first.
- Pend the edit
- Make the changes to the file
- Check in the workspace.
Example:
GetStatus status = workspace.Get(new GetRequest(migrationPath, RecursionType.None,
VersionSpec.Latest),GetOptions.Overwrite);
workspace.PendEdit(migrationPath);
checkInAuthor = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
Robaticus
2010-06-02 15:06:34
A:
It turned out that even though I had added the files and checked in the files, it seemed that the workspace didn't recognize that the files were there, and as a result I had to do a Get() prior to the PendEdit()
MasterMax1313
2010-06-04 12:14:36