Replacing obsolete TfsTeamProjectcollection(Uri, iCredentials) RRS feed

  • Question

  • I have a test project which updates associated work items in TFS when the tests are run, using Microsoft.TeamFoundation.Client and Microsoft.TeamFoundation.WorkItemTracking.Client.

    I am getting the collection of workitems with the following line:

                TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(tfsUri, networkCredential);

    The networkCredential variable is declared like this right now (i found this code at stackoverflow - a bit wonky but it works):

                ICredentials networkCredential = new NetworkCredential(tfsUsername, tfsPassword);
    I am getting a warning that states: CS0618 'TfsTeamProjectCollection.TfsTeamProjectCollection(Uri, ICredentials)' is obsolete: 'This constructor is obsolete and will be removed in a future version. See TfsTeamProjectCollection.TfsTeamProjectCollection(Uri, VssCredentials) instead'.

    So I want to change from the iCredentials class to the VssCredentials class. But I have not found much documentation on the VssCredentials and the constructors I found didn't work.

    Would appreciate any help in forming the right declaration...

    Ken Blaker

    Friday, October 20, 2017 12:10 AM

All replies