TFS API Exception thrown: ‘System.MissingMethodException’ in MyApp.exe

January 07, 2017

The following error:

Exception thrown: ‘System.MissingMethodException’ in CreateTestCase.exe

Additional information: Method not found: ‘Void Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore..ctor(Microsoft.TeamFoundation.Client.TfsTeamProjectCollection)‘.

Occurred for me while trying to execute the following code:



public static IEnumerable<string> GetAllDistinctWorkItemTags(string uri, string projectName)
{
    TfsTeamProjectCollection tfs;

    tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(uri)); // https://mytfs.visualstudio.com/DefaultCollection
    tfs.Authenticate();

    var wis = new WorkItemStore(tfs);

    WorkItemCollection workItemCollection = wis.Query(
                 " SELECT [System.Tags]" +
                 " FROM WorkItems " +
                 $" WHERE [System.TeamProject] = '{projectName}' ");

Bizarrely, I was following my own blog post to create a test case, reading tags from the system.

This threw me for some time. I had a good idea it was caused by the wrong version of the Work Item Tracking extension library.

TeamExtensions

After a bit of searching, I came to the conclusion that MS don’t really support this method of integrating with TFS anymore; at least not for later versions. Consequently, I went to Nuget:

https://www.nuget.org/packages/Microsoft.TeamFoundationServer.ExtendedClient/

Installing this magically sorted the issue for me.



Profile picture

A blog about one man's journey through code… and some pictures of the Peak District
Twitter

© Paul Michaels 2024