Prerequisites
- LinqPad (of course)
- Team Explorer (as part of your complete VS2010 installation)
Setup
- Inside LinqPad create a new empty query and in the Language combo box select C# Statements.
- Go to the Query Properties page by the Query menu or by pressing F4.
- You can add assembly references using two ways in the Additional References tab, by browsing or adding them from the GAC
Adding assembly reference by browsing
- Press the Browse button
- The assemblies we want are under C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.
Adding assembly references by adding from the GAC
- Press the Add button
- Check the Show GAC assemblies option
- Enter TeamFoundation in the textbox
Usually we need at least:
- Microsoft.TeamFoundation.Client.dll
- Microsoft.TeamFoundation.Common.dll
- Microsoft.TeamFoundation.VersionControl.Client.dll
- Microsoft.TeamFoundation.Build.Client.dll
Now, in the Additional Namespace Imports add the following lines
- Microsoft.TeamFoundation.Client
- Microsoft.TeamFoundation.Framework.Client
- Microsoft.TeamFoundation.VersionControl.Client
- Microsoft.TeamFoundation.Build.Client
We are now ready to write our first query
A first query
Let’s start with something simplevar tfs = TfsTeamProjectCollectionFactory .GetTeamProjectCollection(new Uri("http://localhost:8088/tfs")); tfs.Dump();
Now press F5 and you should get a result like below
That’s it. You are now ready to start writing useful LinqPad queries against your TFS server.
What's next
You should take a look at useful queries I wrote using LinqPad and the TFS API here.
1 comment:
Thank you for posting this. It is very well written and eliminated some confusion I had. In particular, it was difficult to find the DLLs for the LINQPad references. So many Microsoft forums had a path didn't include the DLLs. Your idea of referencing the GAC was the key I hadn't considered.
Thanks!!
Post a Comment