I do quite a lot of Build customizations and usually I create a new Build Template for each type of Build I want to do.
You can choose to copy the file in the Build Definition Editor or you can just Copy/Paste the file in Windows Explorer. The advantage of the editor is that it directly copies the file to Source Control.
When you do Build Customizations, it is necessary to have a solution that contains a project with the templates, and a project with your custom activities. In my case I have a template project that contains all my different Build Template XAML files. When you copy a template and build the solution, the following error pops up.
The type ‘TfsBuild.Process’ already contains a definition for…”
What is happening here?? It even gives you this message when you copy it from the Build Definition Editor.
The Build Template is a XAML file and is handled that way by the compiler. If you open the properties of your Build Template file in the solution explorer, the Build Action is set to XamlAppDef for Workflow files.
When this is the case, source is generated each time when you build. You can set the Build Action to None to fix the problem. However, this does not compile the workflow and you can not programmatically call this.
Sometimes you want to achieve this and thus set the Build Action to XamlAppDef. When you have 1 workflow everything is fine, When you copy the workflow the problems start. The code that is generated on compile time looks in the xaml file to obtain the namespace. Because you copied the file, the namespace is the same and the same class is generated for different workflows.
To fix this right click the Build Template XAML file and choose View Code.
In the first line there is the name of the generated class
Rename this to something you like. For example TfsBuild.BlogExampleTemplate
Keep the “TfsBuild” for now….
The rest of the file points to <this:Process
Replace all occurrences of this:Process with this:BlogExampleTemplate.
That’s it. Reload the file and you’re done.
If you also want to change “TfsBuild” in your own namespace for example “Company” change the x:Class attribute in "MyCompany.BlogExampleTemplate” and the
Good luck !