Tag: tfs

在Visual Studio中构建的代码将无法在TFS中生成

我在C#类中定义了两个扩展方法。 当我编译在Visual Studio 2015中使用这些扩展方法的代码时,它们可以正确编译。 当我在本地Team Foundation Build Server上运行相同的代码时,使用MSBuild 2015和/p:VisualStudioVersion=14.0,代码将无法编译。 我需要采取哪些额外步骤来配置构建服务器以便代码编译? 这些是相关的方法签名 public static IEnumerable LeftOuterJoin(this IEnumerable outer, IEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func resultSelector) where TInner : class; public static IEnumerable LeftOuterJoin(this IEnumerable outer, IEnumerable inner, Func outerKeySelector, Func innerKeySelector, Func resultSelector) where TInner : class 这是构建服务器上的编译错误: 我在C#类中定义了两个扩展方法。 当我编译在Visual Studio 2015中使用这些扩展方法的代码时,它们可以正确编译。 当我在本地Team Foundation Build […]

如何获取引用特定迭代路径的查询名称

使用选定的项目名称,我加载了迭代路径。 现在我需要获取引用所选迭代路径的查询名称。 用于加载传递项目名称的迭代路径的代码: private void LoadIterationPaths(string projectName) { var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(_tfs.Uri); var wiStore = tfs.GetService(); var projCollections = wiStore.Projects; var detailsOfTheSelectedProject = projCollections.Cast().Where(project => !String.IsNullOrEmpty(_selectedTeamProject.Name)) .FirstOrDefault(project => project.Name.Contains(_selectedTeamProject.Name)); var iterationPathsList = GetIterationPaths(detailsOfTheSelectedProject); foreach (var iterationPath in iterationPathsList.Where(iterationPath => iterationPath.Contains(projectName))) { cmbIterationPath.Items.Add(iterationPath); } cmbIterationPath.Enabled = cmbIterationPath.Items.Count > 0; } 现在,我需要获取引用所选迭代路径的查询名称列表。 谢谢。 注意 :我能够获得项目中的所有查询名称,但我不需要。 为此,我使用了以下代码 foreach […]

如何初始化VersionControlServer类?

我想从TFS 2013下载文件。我找到了VersionControlServer类: msdn 但是如何初始化呢? VersionControlServer vs; vs.DownloadFile(repositoryPath,localPath); // vs not initialized! 谢谢!

你如何从ac#客户端发送补丁请求?

我有一个PowerShell脚本,它执行此操作: $uri = “$($tfsUri)/$($teamproject)/_apis/build/builds/$($buildID)?api-version=2.0″ $data = @{keepForever = $keepForever} | ConvertTo-Json $response = $webclient.UploadString($uri,”PATCH”, $data) 我正在尝试使用Webclient在C#中重写它。 WebClient client = new WebClient(); client.Encoding = System.Text.Encoding.UTF8; string reply = client.UploadString(url, “keepForever = true”); Console.WriteLine(reply); 但我得到:远程服务器返回错误:(401)未经授权。 这是TFS 2015 VNext,如果有帮助的话。

RegisteredTfsConnections.GetProjectCollection我得到nullexception

我有一些来自MS的示例代码连接到TFS并返回没有问题的集合和项目。 但是当我使用不同的代码连接来获取版本控制数据时,我得到一个空的exception错误。 using System; using System.Collections.ObjectModel; using Microsoft.TeamFoundation.Client; using Microsoft.TeamFoundation.Framework.Common; using Microsoft.TeamFoundation.Framework.Client; using Microsoft.TeamFoundation.VersionControl.Client; namespace TfsApplication { class Program { static void Main(String[] args) { /* Working Code Base */ // Connect to Team Foundation Server // Server is the name of the server that is running the application tier for Team Foundation. // Port […]

如何通过编程方式通过代理连接到TFS?

在我的公司,我们最近为TeamFoundationServer设置了TeamFoundation代理。 我编写了一个C#应用程序,它连接到TFS以查询各种内容。 现在,我希望该应用程序也支持通过TFS代理连接。 由于我对TFS并不熟悉,所以我遇到了一些困难。 理想情况下,我希望应用程序只“知道”TFS代理并让它像普通的TFS一样运行。 这有可能吗? 我在做什么是这样的: TfsTeamProjectCollection projects = new TfsTeamProjectCollection(new Uri(serverUriString, new NetworkCredential(username, password, domain)); 如果serverUriString是TFS(例如“ http:// MyTfs:8080 ”),这可以正常工作。 当我用TFS代理替换它(例如“ http:// MyTfsProxy:8081 ”)时,我得到一些非特定的TeamFoundationServiceUnavailableException ,最后它表明发生了一个http 404错误。 404对我来说没有多大意义,我能够ping服务器,我可以从浏览器连接到它,Visual Studio也可以加入它。 我是否需要设置与TFS和代理的连接? 如果是,我该怎么做?

从在线checkin TFS中排除文件夹

我正在使用visualstudio.com作为TFS在线,并在那里创建了我的代码回购。 在我的项目中,有一个包含多个子文件夹的文件夹,每个子文件夹有几个图像(所有图像的总数就像6000)。 当我签入我的代码时,我不希望根文件夹(即图像子文件夹的父文件夹)及其内容被检查? 我在网上尝试了一些答案,但找不到任何准确的答案。 在此先感谢您的帮助。

使用TFS 2012 API,如何获取用户的电子邮件地址?

我正在尝试使用API​​获取TFS 2012中特定用户的电子邮件地址。 我在“配置文件”部分设置了用户首选电子邮件地址。 我已经在网上进行了大量搜索并获得了以下代码。 var userId = “myUserId”; var collection = new TfsTeamProjectCollection(tfsUri, tfsCerd); var managementService = collection.GetService(); var member = managementService .ReadIdentity( IdentitySearchFactor.AccountName, userId, MembershipQuery.Direct, ReadIdentityOptions.ExtendedProperties); var emailAddress = member.GetAttribute(“Mail”, null) 这段代码既是成功又是失败。 它成功地检索了指定的用户; 但是,问题是Email属性为空。 当我分析成员变量时,我注意到那里列出了“Mail”属性并且它是空的。 然后我注意到还有另外两个名为“ConfirmedNotificationAddress”和“CustomNotificationAddress”的属性,它们在那里正确地使用了我喜欢的电子邮件地址。 我想知道为什么我似乎无法使用首选电子邮件地址正确加载“Mail”变量,因为我将需要此代码在许多人服务器上工作。

使用TFS 2010 API订阅Workspace Events

我正在尝试编写一些代码来监视本地工作站上的TFS工作区,但目前我遇到了触发事件的问题。 例如,如果我在我的工作区中映射一个新文件夹,我想订阅versionControl.UpdatedWorkspace事件,如果我执行“get”,我想映射到versionControl.Getting事件。 下面的代码是一个控制台应用程序,我认为应该可以工作,但是当我这样做时,什么也没发生。 有谁知道如何成功订阅这些活动? VS2010,TFS 2010,WinXP SP3 using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Net; using System.Text; using Microsoft.TeamFoundation.Client; using Microsoft.TeamFoundation.Framework.Client; using Microsoft.TeamFoundation.Framework.Common; using Microsoft.TeamFoundation.VersionControl.Client; namespace TestEventHanling { class Program { static void Main(string[] args) { Uri serverUri = new Uri(@”http://TfsServer:8080/tfs/collection”); using (TfsTeamProjectCollection collection = new TfsTeamProjectCollection(serverUri, CredentialCache.DefaultCredentials)) { VersionControlServer versionControl = (VersionControlServer)collection.GetService(typeof(VersionControlServer)); […]

如何通过代码在TFS工作项中设置’分配给’?

我试图通过代码创建一个工作项。 目前我使用以下代码将Assigned设置为。 wi.Fields[“System.AssignedTo”].Value = “TfsUser display name”; 目前我正在设置TFS用户显示名称。 我有疑虑。 TFS中的显示名称是唯一的吗? 如果不是如何设置像帐户名一样的唯一名称?