gng
gng

Reputation: 705

Issues with multiple build template (xaml files) in project

I'm having trouble with my TFS Build project. I'm following the example from here as far as setting up the project in VS.

I have a project just for the custom activities and a separate project for just the templates. The issue I have is that the Templates project can only contain one xaml file. If I copy and and paste it in the same project it wont build. I get the following error:

Error 102 The item "obj\Debug\TfsBuild_Process_BeforeInitializeComponentHelper.txt" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter.

But if I remove it, it'll build just fine. Everything works, meaning it'll build if I queue a build.

I have also tried the solution suggested on here, but it doesn't seem to resolve my issue.

Solution:

Renaming the form name in the solution explorer.

Change the class name in the .cs and Designer.cs file.

Change the constructor and destructor name (which is same as class name)

Change the name space name (if needed).

Here is the link to download the project.

I can't seem to figure out why. Any help is greatly appreciated!

Upvotes: 7

Views: 2437

Answers (3)

harlam357
harlam357

Reputation: 1491

I used the following approach and it worked very well. All that needs replaced is TfsBuild in two locations on the first line of the raw xaml.

http://social.msdn.microsoft.com/Forums/vstudio/en-US/d3fb6b89-b711-4a02-a10a-a88a0cb4f714/unable-to-add-more-than-one-templatexaml-into-activity-library-workflow-project?forum=tfsprocess

From the link:

1 Right-click your Copy of DefaultTemplate.xaml in Source Control and select View With… to open it in Notepad (you can also right-click the template in VS and select 'View Code').

2 Then in the first line change:

  1. **x:Class="TfsBuild.Process"** to **x:Class="YourProcessTemplateName.Process"**
  2. **xmlns:this="clr-namespace:TfsBuild"** to **xmlns:this="clr-namespace:YourProcessTemplateName"**

Upvotes: 5

llMll
llMll

Reputation: 505

I don't know if you still have this problem but I also had the problem today. I found a resolution that (if you still facing the problem) can help you or others.

When you copy a Build Process template it automaticly gets the x:Class property set to TfsBuild.Process. When you have multiple process templates with the same value then you will get this error when building the project.

<Activity mc:Ignorable="sads sap sap2010" x:Class="TfsBuild.Process" this:Process.BuildNumberFormat="$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)" this:Process.AgentSettings="[New Microsoft.TeamFoundation.Build.Workflow.Activities.AgentSettings() With {.MaxWaitTime = New System.TimeSpan(4, 0, 0), .MaxExecutionTime = New System.TimeSpan(0, 0, 0), .TagComparison = Microsoft.TeamFoundation.Build.Workflow.Activities.TagComparison.MatchExactly}]" this:Process.Verbosity="[Microsoft.TeamFoundation.Build.Workflow.BuildVerbosity.Normal]" this:Process.OutputFullHistory="True" this:Process.OutputBranchOrigin="True" this:Process.OnlyOutputChangedFiles="True" this:Process.StartChangeset="0"...... 

I solved the problem by replacing TfsBuild.Process with another name for every template (ex. TfsBuild.ProcessLabDefault). Please note you should also change all the instances of this:Process because the two are linked together (ex. this:ProcessLabDefault).

<Activity mc:Ignorable="sads sap sap2010" x:Class="TfsBuild.MyProcess" this:MyProcess.BuildNumberFormat="$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)" this:MyProcess.AgentSettings="[New Microsoft.TeamFoundation.Build.Workflow.Activities.AgentSettings() With {.MaxWaitTime = New System.TimeSpan(4, 0, 0), .MaxExecutionTime = New System.TimeSpan(0, 0, 0), .TagComparison = Microsoft.TeamFoundation.Build.Workflow.Activities.TagComparison.MatchExactly}]" this:MyProcess.Verbosity="[Microsoft.TeamFoundation.Build.Workflow.BuildVerbosity.Normal]" this:MyProcess.OutputFullHistory="True" this:MyProcess.OutputBranchOrigin="True" this:MyProcess.OnlyOutputChangedFiles="True" this:MyProcess.StartChangeset="0"...... 

I didn't find a way to change this by using the interface, View Code & Find and replace works. Hope it helps.

Upvotes: 8

DSage
DSage

Reputation: 1

I ran in to this problem and wanted to add the solution I found to it. If you check the properties of the XAML files, when you link them to your project they're assigned a BuildAction of XamlAppDef. Changing this to 'Content' will resolve the error.

To find the properties screen you need to edit just highlight the XAML file in Solution Explorer and either hit F4 or Right-Click on the file and choose 'Properties' from the context menu.

Hope this helps.

Upvotes: 0

Related Questions