How do I get a WorkItemStore from TFS using powershell?
I've tried the following:
function get-tfs {
param(
[string] $ServerName = "http://MyServer:8080/tfs"
)
begin{}
process
{
[psobject] $tfs = [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]::GetServer($serverName)
return $tfs
}
end{}
}
[Reflection.Assembly]::LoadFrom("C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.WorkItemTracking.Client.dll")
The above code executes fine and I have a value for $tfs.
Then I do this:
$wis = $tfs.GetService([Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore])
But $wis is null. Same thing if I do this instead:
$wis = $tfs.TfsTeamProjectCollection.GetService([Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore])
Also, if I do this, powershell says it cannot find assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client' even though it just found it and loaded it a second ago: Add-Type -AssemblyName Microsoft.TeamFoundation.WorkItemTracking.Client
I don't understand why it found the assembly then suddenly can't find it anymore.
What am I doing wrong?