The following code works fine for .Net 4.8 with Nuget Microsoft.TeamFoundationServer.ExtendedClient Version=”16.205.1″
using System;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.VersionControl.Client;
using Microsoft.VisualStudio.Services.WebApi;
using Microsoft.VisualStudio.Services.Common;
namespace TfsWorkspaceGet
{
class Program
{
static void Main(string[] args)
{
// Create VSS credentials
VssBasicCredential vssCred = new VssBasicCredential(
"valid userid",
"valid PAT token");
// connect to TFS
var tfsCollection = new TfsTeamProjectCollection(new Uri("https://someorg.com/tfs/projects"));
tfsCollection.EnsureAuthenticated();
//connect to Azure DevOps using the basic credentials
var connection = new VssConnection(new Uri(tfsUrl), vssCred);
var versionControlServer = tfsCollection.GetService<VersionControlServer>();
// Create a workspace
Workspace workspace = versionControlServer.CreateWorkspace("tmpTfsWorkspace");
// Map the server path to the local path
workspace.CreateMapping(new WorkingFolder(
"$/SomProj/Mainline/DEV/SomeComponent",
@"D:WSSomProjMainlineDEVSomeComponent"));
// Get the latest version
workspace.Get();
}
}
}
Am trying to get it upgraded to working with .Net 6+… unsuccessfully
- Just upgrading the Nuget to consume .Net compatible Microsoft.TeamFoundationServer.ExtendedClient Version=”19.225.1″ shows multiple classes missing like
- TfsTeamProjectCollection,
- GetService
- Workspace
Most of the examples online seem to be centered around Git.
And the closest Ive got is to using
connection.GetClient<TfvcHttpClient>
Though it does match for the Workspacesetup and get needs
Any help or pointers on this?