Я очень близко следую примеру Azure-devops-dotnet-samples CreateBugUsingClientLib (), но
GetClient<WorkItemTrackingHttpClient>()
бросает:
InnerException: {"Не удалось привести или преобразовать из System.String в Microsoft.VisualStudio.Services.Identity.IdentityDescriptor."} System.Exception {System.ArgumentException}
Сообщение: «Ошибка преобразования значения \» Microsoft.IdentityModel.Claims.ClaimsIdentity; stuff \ me@contoso.com \ "для ввода« Microsoft.VisualStudio.Services.Identity.IdentityDescriptor ». Путь« authenticatedUser.descriptor »
Полный образец здесь: https://github.com/Microsoft/azure-devops-dotnet-samples/blob/master/ClientLibrary/Quickstarts/dotnet/WitQuickStarts/Samples/CreateBug.cs
Все мои NuGets обновлены.
// string uri = "https://teams.visualstudio.com/defaultCollection/"
// string pat = "personal access token";
// string project = "Ateam";
// string path = "autobug";
// string title = "you broke it";
// string steps = "you touched it";
var patchDoc = new JsonPatchDocument
{
new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/System.Title", Value = title },
new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/System.AreaPath", Value = path },
new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/Microsoft.VSTS.TCM.ReproSteps", Value = steps },
new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/Microsoft.VSTS.Common.Priority", Value = "2" },
new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/Microsoft.VSTS.Common.Severity", Value = "2" }
};
var cred = new VssBasicCredential("", pat);
var conn = new VssConnection(new Uri(uri), cred);
var client = conn.GetClient<WorkItemTrackingHttpClient>();