问题
I use TFS 2010 with VS 2017, I followed this article to customize my build: https://msdn.microsoft.com/en-us/library/hh850441(v=vs.120).aspx
When I compile my solution, I dont get any errors, but when I launch the Build Definition with my CustomTemplate (from TFS 2010); I get theses errors:
Type 'IBuildAgent' is not defined.
Type 'IBuildDetail' is not defined.
All the error:
The build process failed validation. Details: Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "BuildDetail.BuildNumber". Type 'IBuildDetail' is not defined. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "DropBuild AndAlso Not String.IsNullOrEmpty(BuildDetail.DropLocation)". Type 'IBuildDetail' is not defined. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "BuildDetail.DropLocation". Type 'IBuildDetail' is not defined. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "BuildDetail.BuildNumber". Type 'IBuildDetail' is not defined. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "BuildDetail.BuildDefinition.Name". Type 'IBuildDetail' is not defined. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "associatedChangesets". Type 'Changeset' is not defined. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "associatedChangesets". Type 'Changeset' is not defined. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "treatTestFailureAsBuildFailure And (BuildDetail.TestStatus = Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Failed)". Type 'IBuildDetail' is not defined. 'Client' is not a member of 'Build'. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "BuildDetail.TestStatus = Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Unknown". Type 'IBuildDetail' is not defined. 'Client' is not a member of 'Build'. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "BuildDetail.CompilationStatus = Microsoft.TeamFoundation.Build.Client.BuildPhaseStatus.Unknown". Type 'IBuildDetail' is not defined. 'Client' is not a member of 'Build'. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "testAssemblies.Count() > 0". 'Count' is not a member of 'System.Collections.Generic.IEnumerable(Of String)'. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "BuildDetail.RequestedFor". Type 'IBuildDetail' is not defined. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "String.Format("Build Failure in Build: {0}", BuildDetail.BuildNumber)". Type 'IBuildDetail' is not defined. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "Not String.IsNullOrEmpty(BuildDetail.DropLocation)". Type 'IBuildDetail' is not defined. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "If (platformConfiguration.IsEmpty Or BuildSettings.PlatformConfigurations.Count = 1, BuildDetail.DropLocation + "\logs", If (platformConfiguration.IsPlatformEmptyOrAnyCpu, BuildDetail.DropLocation + "\logs\" + platformConfiguration.Configuration, BuildDetail.DropLocation + "\logs\" + platformConfiguration.Platform + "\" + platformConfiguration.Configuration))". Type 'IBuildDetail' is not defined. Type 'IBuildDetail' is not defined. Type 'IBuildDetail' is not defined. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "String.Format("{0}@$/{1}", LabelName, BuildDetail.BuildDefinition.TeamProject)". Type 'IBuildDetail' is not defined. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "String.Format("$/{0}", BuildDetail.BuildDefinition.TeamProject)". Type 'IBuildDetail' is not defined. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "WorkspaceName.Length > Microsoft.TeamFoundation.VersionControl.Common.RepositoryConstants.MaxWorkspaceNameSize". 'VersionControl' is not a member of 'TeamFoundation'. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "WorkspaceName.Substring(0, Microsoft.TeamFoundation.VersionControl.Common.RepositoryConstants.MaxWorkspaceNameSize).TrimEnd()". 'VersionControl' is not a member of 'TeamFoundation'. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "String.Format("The workspace name '{0}' exceeds the maximum allowed limit of '{1}' characters. Truncating it to match the maximum limit.", WorkspaceName, Microsoft.TeamFoundation.VersionControl.Common.RepositoryConstants.MaxWorkspaceNameSize)". 'VersionControl' is not a member of 'TeamFoundation'. Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "String.Format("{0}{1}{2}", BuildDetail.BuildDefinition.Id, Microsoft.TeamFoundation.LinkingUtilities.DecodeUri(BuildAgent.Uri.AbsoluteUri).ToolSpecificId, BuildAgent.ServiceHost.Name)". Type 'IBuildDetail' is not defined. 'LinkingUtilities' is not a member of 'TeamFoundation'. Type 'IBuildAgent' is not defined. Type 'IBuildAgent' is not defined.
回答1:
It seems that VS2017 and TFS2010 are not compatible.
来源:https://stackoverflow.com/questions/43472021/tfs-2010-type-ibuildagent-and-type-ibuilddetail-are-not-defined