I have a minimal working exmaple on github to reproduce my case. The following code throws an exception:
var wc = new WindowsCredential(new NetworkCredential(userName, password, domain));
var credentials = new VssCredentials(wc);
var buildHttpClient = new Microsoft.TeamFoundation.Build.WebApi.BuildHttpClient(new Uri(tfsUrl), credentials);
The exception is as follows (I apologize for the German message, it means "File or dependency not found"):
System.IO.FileNotFoundException
HResult=0x80070002
Message=Die Datei oder Assembly "System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.
Source=Microsoft.VisualStudio.Services.WebApi
This exception is only thrown, if the code is called from another assembly such as my ConsoleExample or TestExample. The code works fine in the assembly where it is located. It does not seem important what you insert as credentials. It seems like you don't even need a running TFS server.
Any help is appreciated. I could reproduce this with Visual Studio 2019 and 2017 and on two computers. Note: The code works with an older version of the respective NuGet packages.