2
votes

I've tried to follow this guide to customize the build process in tfs:

http://msdn.microsoft.com/en-us/library/dd647551.aspx

But after downloading the .xaml file and trying to open it in Visul studio 2013 I get an error:

System.Xaml.XamlException: 'The type ‘InArgument(mtbco:BuildParameter[])’ of property ‘AutomatedTests’ could not be resolved.' Line number '5' and line position '39'.
at System.Activities.XamlIntegration.DynamicActivityXamlReader.BufferedPropertyList.ActivityPropertyHolder..ctor(DynamicActivityXamlReader parent, XamlReader reader)
at System.Activities.XamlIntegration.DynamicActivityXamlReader.BufferedPropertyList.BufferDefinitions(DynamicActivityXamlReader parent)
at System.Activities.XamlIntegration.DynamicActivityXamlReader.ProcessCurrentNode()
at System.Activities.XamlIntegration.DynamicActivityXamlReader.Read()
at Microsoft.Activities.Presentation.Xaml.ActivityTemplateFactoryBuilderReader.Read()
at Microsoft.Activities.Presentation.Xaml.ViewStateXamlHelper.StripViewStateElement(XamlReader inputReader, Dictionary`2& viewStateInfo, Dictionary`2& viewStateSourceLocationMap)
at Microsoft.Activities.Presentation.Xaml.ViewStateXamlHelper.ConvertViewStateToAttachedProperties(XamlReader inputReader, ViewStateIdManager idManager, Dictionary`2& viewStateSourceLocationMap)
at Microsoft.Activities.Presentation.Xaml.WorkflowDesignerXamlHelper.DeserializeString(String text, DeserializationMode mode, IList`1& loadErrors, Dictionary`2& sourceLocations)
at Microsoft.Activities.Presentation.Xaml.WorkflowDesignerXamlHelper.DeserializeString(String text, IList`1& loadErrors, Dictionary`2& sourceLocations)
at System.Activities.Presentation.WorkflowDesigner.Load()

This is the beginning of the .xaml file:

<Activity x:Class="TfsBuild.Process" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mt="clr-namespace:Microsoft.TeamFoundation;assembly=Microsoft.TeamFoundation.Common" xmlns:mtbc="clr-namespace:Microsoft.TeamFoundation.Build.Client;assembly=Microsoft.TeamFoundation.Build.Client" xmlns:mtbco="clr-namespace:Microsoft.TeamFoundation.Build.Common;assembly=Microsoft.TeamFoundation.Build.Common" xmlns:mtbw="clr-namespace:Microsoft.TeamFoundation.Build.Workflow;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mtbwa="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Activities;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mtba="clr-namespace:Microsoft.TeamFoundation.Build.Activities;assembly=Microsoft.TeamFoundation.Build.Activities" xmlns:mtbac="clr-namespace:Microsoft.TeamFoundation.Build.Activities.Core;assembly=Microsoft.TeamFoundation.Build.Activities" xmlns:mtbag="clr-namespace:Microsoft.TeamFoundation.Build.Activities.Git;assembly=Microsoft.TeamFoundation.Build.Activities" xmlns:mtbat="clr-namespace:Microsoft.TeamFoundation.Build.Activities.TeamFoundation;assembly=Microsoft.TeamFoundation.Build.Activities" xmlns:mtbwt="clr-namespace:Microsoft.TeamFoundation.Build.Workflow.Tracking;assembly=Microsoft.TeamFoundation.Build.Workflow" xmlns:mttbb="clr-namespace:Microsoft.TeamFoundation.TestImpact.BuildIntegration.BuildActivities;assembly=Microsoft.TeamFoundation.TestImpact.BuildIntegration" xmlns:mtvc="clr-namespace:Microsoft.TeamFoundation.VersionControl.Client;assembly=Microsoft.TeamFoundation.VersionControl.Client" xmlns:mtvco="clr-namespace:Microsoft.TeamFoundation.VersionControl.Common;assembly=Microsoft.TeamFoundation.VersionControl.Common" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:sad="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:sad1="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:this="clr-namespace:TfsBuild;" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<x:Members>
<x:Property Name="ProjectsToBuild" Type="InArgument(s:String[])" />
<x:Property Name="ConfigurationsToBuild" Type="InArgument(s:String[])" />
<x:Property Name="AutomatedTests" Type="InArgument(mtbco:BuildParameter[])" /> 
<x:Property Name="AdvancedTestSettings" Type="InArgument(mtbco:BuildParameter)" />
<x:Property Name="BuildNumberFormat" Type="InArgument(x:String)" />
<x:Property Name="GetVersion" Type="InArgument(x:String)" />
<x:Property Name="CleanWorkspace" Type="InArgument(x:Boolean)" />
<x:Property Name="CreateLabel" Type="InArgument(x:Boolean)" />
<x:Property Name="AdvancedBuildSettings" Type="InArgument(mtbco:BuildParameter)" />
...

It wasn't mentioned in the guide, but I added a reference to "Microsoft.TeamFoundation.TestImpact.BuildIntegration" in folder "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies". But it did not help.

The default template I am using is: "Default Template (TfvcTemplate.12.xaml).

Do I need to add some more references?

3

3 Answers

8
votes

I changed the .NET version of the project from .NET 4 to .NET 4.5 and it solved the issue. I can now view the template in both code and design view without error.

3
votes

Open the xaml file in an editor of choice, review all xmlns-imports (line-wrapping might help) and add all references to assemblies mentioned in this section.

If you are missing assemblies, you can install the TFS Object Model package but respect the version of your TFS. There are special packages for TFS 2013, TFS 2015 and even the "Update" versions.

0
votes

If you are using an older Build template template, you would need to create a Visual Studio Windows Workflow project, add references to the assemblies and add your build template as a link. You will then be able to open and edit your build templates.