How to get path to file path in a Workspace by C# in a customized activity of TFS 2012 build process template?

1.1k views Asked by At

I'm writing a customized activity for TFS build process workflow, e.g. guideline here.

In my C# CodeActivity .Execute() method, I want to get path to file and/or folder in a Workspace I tried google and found ConvertWorkspaceItem here but I don't know how to run it and discussed here.

If you know how to, please share.

1

There are 1 answers

0
jessehouwing On

The ConvertWorkspaceItem is an activity. In your custom code activity, you can either create an instance of this activity, set the required parameters and call the Execute() method. Or you can use the VersionControlServer.TryGetWorkspace and which returns a Workspace object. Use Workspace.GetLocalItemForServerItem or the reverse Workspace.GetServerItemForLocalItem.