Getting the System Root Directory during TFS Build was not straightforward as I thought, so I decide to share my experience on how to get that.
- I used InvokeMethod activity, in the Target Type I will put the name of the static class that has the method I need use.
- In MethodName, I will put GetEnviornmentVariable.
- Write the value to the build log by calling WriteBuildError and past the value return from GetEnviornmentVariable.
For InvokeMethod activity, if I need to call a method from an instance object then I will use Target Object not Target Type.