NetTfsClient 1.6.0

dotnet add package NetTfsClient --version 1.6.0
                    
NuGet\Install-Package NetTfsClient -Version 1.6.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NetTfsClient" Version="1.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NetTfsClient" Version="1.6.0" />
                    
Directory.Packages.props
<PackageReference Include="NetTfsClient" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NetTfsClient --version 1.6.0
                    
#r "nuget: NetTfsClient, 1.6.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NetTfsClient@1.6.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NetTfsClient&version=1.6.0
                    
Install as a Cake Addin
#tool nuget:?package=NetTfsClient&version=1.6.0
                    
Install as a Cake Tool

NetTfsClient

Run tests

A .NET client library for the Azure DevOps and Team Foundation Server (TFS) REST APIs. It focuses on work items, projects, teams, and related areas you typically need in automation and tools.

Features

  • Connection & auth — Personal Access Token (PAT), NTLM (username/password), default Windows credentials, ClaimsPrincipal, or a custom IHttpClient.
  • Projects & orgIProjectClient: projects, teams, team members, identities/groups (see interface for full list).
  • Work itemsIWorkitemClient: get/update/create/copy, relations, history, WIQL and saved queries, changesets.
  • MentionsIMentionClient to add @mentions via history (uses a non-public API; see remarks on SendMentionAsync).

Requirements

Installation

Add the NuGet package to your project:

dotnet add package NetTfsClient

Or via Visual Studio: Manage NuGet Packages → search for NetTfsClient.

Concepts

Server URL

Pass the base URL of your organization or TFS instance, for example:

  • Azure DevOps Services: https://dev.azure.com/your-organization/
  • On-premises TFS / Azure DevOps Server: https://your-server/tfs/

A trailing / is optional; the client normalizes it.

Project name: Collection/Project

The projectName argument identifies the team project and, when applicable, the project collection. Use the form CollectionName/ProjectName (e.g. DefaultCollection/MyProduct). If you only need collection-level APIs, you can use a collection-only value such as DefaultCollection (see IClientConnection for how this splits into CollectionName and ProjectName).

Authentication

All flows go through ClientFactory.CreateClientConnection and return IClientConnection, which exposes ServerUrl, CollectionName, ProjectName, and the underlying IHttpClient.

Method Usage
PAT CreateClientConnection(serverUrl, projectName, personalAccessToken)
NTLM CreateClientConnection(userName, userPassword, serverUrl, projectName)projectName defaults to DefaultCollection if omitted
Default credentials (current user) CreateClientConnection(serverUrl, projectName)
Claims CreateClientConnection(serverUrl, projectName, claimsPrincipal)
Custom CreateClientConnection(httpClient, projectName)httpClient must have BaseUrl set

Extension methods on IClientConnection (in NetTfsClient.Services):

  • GetWorkitemClient()IWorkitemClient
  • GetProjectClient()IProjectClient
  • GetMentionClient()IMentionClient

Quick start

using NetTfsClient.Services;

var serverUrl = "https://dev.azure.com/contoso";
var projectName = "DefaultCollection/MyProject";
var pat = /* Personal Access Token with required scopes */;

var connection = ClientFactory.CreateClientConnection(serverUrl, projectName, pat);

// Projects and teams
var projectClient = connection.GetProjectClient();
var projects = await projectClient.GetProjectsAsync();

// Work items
var workitemClient = connection.GetWorkitemClient();
var workItem = await workitemClient.GetSingleWorkitemAsync(42);

if (workItem != null)
{
    Console.WriteLine(workItem["System.Title"]);
    workItem.Title = "Updated title";
    await workItem.SaveFieldsChangesAsync();
}

For a full runnable sample (including User Secrets for URL, project, and PAT), see TfsClient.App/Program.cs.

Building and testing

From the repository root:

dotnet restore
dotnet build --configuration Release
dotnet test

Integration tests may require Azure DevOps/TFS environment variables (see the test project and .github/workflows/tests.yaml for ENV_SERVER_URL, ENV_PROJECT_NAME, and ENV_PAT).

Documentation in code

Public contracts are documented with XML comments on ClientFactory, IClientConnection, IWorkitemClient, IProjectClient, and related types. For REST endpoint references, many IProjectClient members link to the official Microsoft REST docs.

Coding style

This repository follows the Google C# Style Guide.

License

See LICENSE.txt.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.6.0 53 4/27/2026
1.5.0 177 10/27/2024
1.4.0 164 5/12/2024
1.3.1 197 2/7/2024
1.3.0 167 2/6/2024
1.2.0 337 9/19/2023
1.1.0 185 8/13/2023
1.0.0 246 4/23/2023