TFS 2015在2012年迁移后构建错误

时间:2016-03-03 11:16:05

标签: visual-studio-2015 tfsbuild tfs2015

我们已经从TFS 2012迁移到TFS 2015,迁移后我们的构建无效。我们收到以下错误。 我在互联网上找不到这么多。 请帮忙。

TF215097: An error occurred while initializing a build for build definition \Cockpit\DB.Dev.MetadataDB.Build: 
Exception Message: Could not load file or assembly 'Microsoft.TeamFoundation, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. (type FileNotFoundException)
Exception Stack Trace: at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.LoadWithPartialNameInternal(AssemblyName an, Evidence securityEvidence, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadWithPartialName(String partialName)
at System.Activities.Expressions.AssemblyReference.LoadAssembly(AssemblyName assemblyName)
at System.Activities.Expressions.AssemblyReference.GetAssembly(AssemblyName assemblyName)
at Microsoft.VisualBasic.Activities.VisualBasicHelper.Initialize(HashSet`1 refAssemNames, HashSet`1 namespaceImportsNames)
at Microsoft.VisualBasic.Activities.VisualBasicHelper.Compile[T](String expressionText, CodeActivityPublicEnvironmentAccessor publicAccessor, Boolean isLocationExpression)
at Microsoft.VisualBasic.Activities.VisualBasicValue`1.CacheMetadata(CodeActivityMetadata metadata)
at System.Activities.CodeActivity`1.OnInternalCacheMetadataExceptResult(Boolean createEmptyBindings)
at System.Activities.Activity`1.OnInternalCacheMetadata(Boolean createEmptyBindings)
at System.Activities.Activity.InternalCacheMetadata(Boolean createEmptyBindings, IList`1& validationErrors)
at System.Activities.ActivityUtilities.ProcessActivity(ChildActivity childActivity, ChildActivity& nextActivity, Stack`1& activitiesRemaining, ActivityCallStack parentChain, IList`1& validationErrors, ProcessActivityTreeOptions options, ProcessActivityCallback callback)
at System.Activities.ActivityUtilities.ProcessActivityTreeCore(ChildActivity currentActivity, ActivityCallStack parentChain, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors)
at System.Activities.ActivityUtilities.CacheRootMetadata(Activity activity, LocationReferenceEnvironment hostEnvironment, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1& validationErrors)
at System.Activities.Validation.ActivityValidationServices.InternalActivityValidationServices.InternalValidate()
at Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers.ValidateWorkflow(Activity activity, ValidationSettings validationSettings)
at Microsoft.TeamFoundation.Build.Hosting.BuildProcessCache.LoadFromXaml(String workflowXaml, TextExpressionImports textExpressionImports)
at Microsoft.TeamFoundation.Build.Hosting.BuildControllerWorkflowManager.PrepareRequestForBuild(WorkflowManagerActivity activity, IBuildDetail build, WorkflowRequest request, IDictionary`2 dataContext)
at Microsoft.TeamFoundation.Build.Hosting.BuildWorkflowManager.TryStartWorkflow(WorkflowRequest request, WorkflowManagerActivity activity, BuildWorkflowInstance& workflowInstance, Exception& error, Boolean& syncLockTaken)
Inner Exception Details:
Exception Message: Could not load file or assembly 'Microsoft.TeamFoundation, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. (type FileNotFoundException)
Exception Stack Trace: 

2 个答案:

答案 0 :(得分:1)

检查您的自定义XAML文件,并确保删除对Version=11.0.0, PublicKeyToken=123445的任何引用。只需用它的简单名称提及大会。这允许Team Build加载与构建服务器版本匹配的版本。

如果您很幸运,旧的自定义项是二进制兼容的,但在最坏的情况下,您需要针对当前版本的TFS CLient对象模型重新编译它们。

另见:

答案 1 :(得分:1)

TFS 2015在构建服务的配置中发布了错误的绑定重定向; TFSBuildServiceHost.exe.config。

<dependentAssembly>
  <assemblyIdentity name="Microsoft.TeamFoundation" 
                    publicKeyToken="b03f5f7f11d50a3a" 
                    culture="neutral"/>
  <bindingRedirect oldVersion="10.0.0.0-12.9.0.0" newVersion="14.0.0.0"/>
</dependentAssembly>

没有Microsoft.TeamFoundation, Version=14.0.0.0

Microsoft.TeamFoundation.dll仅在TFS 2012之前存在,之后此dll中的命名空间已合并到Microsoft.TeamFoundation.Common.dll

我向微软提出了Connect Bug。您可以将模板中的Microsoft.TeamFoundation引用更新为Microsoft.TeamFoundation.Common,也可以删除/修改重定向到以下内容。

<dependentAssembly>
  <assemblyIdentity name="Microsoft.TeamFoundation" 
                    publicKeyToken="b03f5f7f11d50a3a" 
                    culture="neutral"/>
  <bindingRedirect oldVersion="10.0.0.0" newVersion="11.0.0.0"/>
</dependentAssembly>

需要注意的是,您在运行TFS 2012的同一基础架构上运行TFS 2015构建服务(或者至少安装了相同的依赖项),Microsoft.TeamFoundation.dll随Visual Studio 2012一起发布