Question background:
I'm trying to do the following process but currently cannot succesfully map the TFS code to the specified local folder:
- Create a temporary work space.
- Set the temporay workspace to be on the C drive in a folder called 'BasicSccExample'
- From a passed object called 'vssItem', concatenate its 'VcQaFolder' and 'Name' properties to set the specified TFS server path.
- Map the TFS server path to the local path.
- Get the latest code from the TFS server.
- Create a folder called 'sub' within the 'BasicSccExample' Folder.
- Create the this new 'basic' folder.
- Check the differences between the local specified file copies.
- Delete the temporary workspace.
The code to carry out the above process:
Workspace workspace = tfServer.CreateWorkspace("BasicSccExample", tfServer.AuthorizedUser);
string topDir = null;
string result = null;
string localDir = @"c:\BasicSccExample";
string test = vssItem.VcQaFolder + "/"+vssItem.Name;
workspace.Map(test, localDir);
workspace.Get();
topDir = Path.Combine(workspace.Folders[0].LocalItem, "sub");
Directory.CreateDirectory(topDir);
var potentialDifference = Difference.DiffFiles(topDir, FileType.Detect(topDir, null), topDir, FileType.Detect(topDir, null), new DiffOptions());
result = potentialDifference.Next == null ? "Identical" : "Different";
workspace.Delete();
The error:
I always receive a null exception when attempting to compare the files - which for testing purpose at the moment are the same file. The reason for this error is because the specified local folder on the C drive that the code should be mapped too is always empty. Can anyone tell me where I'm going wrong?