我正在尝试使用c#连接到以前称为TFS的Azure DevOps.我想连接到它而没有azure DevOps的登录屏幕.我目前正在尝试以下代码,但有些代码无法正常工作
NetworkCredential netCred = new NetworkCredential("test@hotmail.com", "test");
Uri tfsuri = new Uri("https://dev.azure.com/test10");
VssBasicCredential bsCred = new VssBasicCredential(netCred);
VssCredentials vssCred = new VssClientCredentials(bsCred);
TfsTeamProjectCollection collection = new TfsTeamProjectCollection(tfsuri, vssCred);
collection.Authenticate();
var witClient = collection.GetClient<ProjectHttpClient>();
var listOfProjects = witClient.GetProjects().Result;
Run Code Online (Sandbox Code Playgroud)
我正在使用的图书馆
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Core.WebApi;
using Microsoft.VisualStudio.Services.Client;
using Microsoft.VisualStudio.Services.Common;
using Microsoft.VisualStudio.Services.Operations;
using Microsoft.VisualStudio.Services.WebApi;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
using Microsoft.TeamFoundation.WorkItemTracking.WebApi;
Run Code Online (Sandbox Code Playgroud)
代码会提示登录屏幕,如果我输入密码,则auth仍然无效.我不希望出现登录屏幕,只想用用户名和密码连接.
使用备用凭据,此方法正在运行,但这不是我的要求,我不能使用备用凭据.
我试过跟踪官方网站上的样本,但没有解决方案适用于新的DevOps.
任何解决方案如何在没有登录屏幕的情况下在新的DevOps中使用usernanme/password进行身份验证
我正在尝试执行 linq 查询来获取所有具有某些特定技能的员工。search.skills 是具有某些技能的字符串列表,我想检索具有所有这些技能(和条件)的所有用户。在我关于员工的 where 子句中,exp.Skills 是 ICollection,expSkill.SkillName 是技能名称
.Where(
emp => search.Skills.All(
searchSkill => emp.Experiences.Select(exp => exp.Skills).SelectMany(x => x).Select(expSkill => expSkill.SkillName).Contains(searchSkill)
))
.ToListAsync();
Run Code Online (Sandbox Code Playgroud)
我在尝试执行它时收到以下错误。我正在使用实体框架核心3
The LINQ expression 'DbSet<Employee>
.Where(e => __search_Skills_0
.All(searchSkill => DbSet<Experience>
.Where(e0 => EF.Property<Nullable<Guid>>(e, "Id") != null && EF.Property<Nullable<Guid>>(e, "Id") == EF.Property<Nullable<Guid>>(e0, "EmployeeId"))
.SelectMany(
source: e0 => DbSet<ExperienceSkill>
.Where(e1 => EF.Property<Nullable<Guid>>(e0, "EmployeeId") != null && new AnonymousObject(new object[]
{
(object)EF.Property<Nullable<Guid>>(e0, "EmployeeId"),
(object)EF.Property<string>(e0, "ProjectCode")
}) == new AnonymousObject(new object[]
{
(object)EF.Property<Nullable<Guid>>(e1, "ExperienceEmployeeId"),
(object)EF.Property<string>(e1, "ExperienceProjectCode")
})),
collectionSelector: (e0, …Run Code Online (Sandbox Code Playgroud) c# linq entity-framework entity-framework-core .net-core-3.0