Custom TFS 2013 activity to merge one branch to another - tfs

We are using TFS 2013 and need to write a custom TFS activity that auto-merges from one branch to another.
So for example merge code from...
$/Parent
to...
$/Other/Parent
If one were to assume a happy path where there are no merge conflicts, can someone show a simple code segment that merges from $/Parent to $/Other/Parent please?
I have found an example for earlier versions of TFS, but the API has changed for 2013, and I am not seeing how to translate it. Here is a link for how to do it in XAML for versions prior to 2010.
Automate Merge With TFS Build
I am seeking a C# code example that does the same thing for 2013.
Thanks.

Do not create custom activities. They are difficult to debug and are only supported for legacy in 2015. Create a PowerShell script that completed the task (you can still call c# in there). The 2013 template has slots for running PowerShell and your scripts will work in the new build system in 2015.

Related

TFS migration - configure features - stream error

Doing the upgrade from TFS 2010 to TFS 2012 (to go after at TFS 2015). No problem during the migration. I'm now at the step to configure features for each project and the verify button give me this error:
Value cannot be null.
Parameter name: stream
Information that can help figure out the problem. We are using the template "EMC - Scrum for team system" and that template was changed a little for our need. Only have 3 work items for that project.
How can I know what to look for to fix this error?
We want to change the template and use the new Agile template from TFS 2015 at the upgrade is done from TFS 2012 to 2015. How can I change from one template to another one inside a TFS project?
thanks
The configure features wizard is not going to be able to do its magic on a customised SfTS3 process template so you're going to be configuring features manually.
Add Features Using a Manual Update Process
It will be a reasonable amount of work but can be done. However, if you plan to migrate to the Agile process (I prefer to use the Scrum process, personally) then you may as well get busy doing that.
Options:
Create a new project with the Agile template and migrate your Work Items/Code (Excel/Integration Platform/etc.)
Start bending the SfTS template into the shape of the Agile template
Migrating Scrum for Team System 3.x to MS Scrum 2.0 /
Migrate a TFS project to another process template

Difference between TFS 2012 and TFS 2013 process templates

We are planning to upgrade from Tfs 2012 to Tfs 2013. Can anyone help me understand the difference in process templates between them? We use all three process templates for different projects.
The changes are very minor, except for:
The introduction of Portfolio backlogs.
Test Plans and test Suites are now Work Item Types (TFS 2013 update 3).
The AgileConfig and CommonProcessConfig files have been merged to a single file inside the template
The minor changes:
Git support for the Source Control options
Stackrank type fields are now hidden by default (because Agile task boards are now features of the Standard CAL).
Tag field support through the API.
The easiest way to visualize all differences is by comparing them through the TFS Team Project Manager which can be downloaded here.
TFS 2013 did not work well with our existing workspaces defined on remote network drives. TFS 2012 did work with this configuration.
After working several hours with our System Administrators, we gave up on trying to get the trying to get the existing network drive workspaces to work with the TFS 2013. Converting the workspaces to local drive locations enabled us to work with TFS 2013.

TFS 2010 Build Defaults - Third option?

I was setting up a new build definition today and noticed there is an option 'Copy build output to the following Source Control folder'. I don't believe I have seen this before. It appears to me from searching google that it might be new as of TFS 11 (AKA TFS 2012) which I do not have installed on my system (or any system in my company network to my knowledge). My company uses TFS 2010 right now.
I went to another user who is able to view build definitions and it also was present when the build definitions were viewed.
This is what i see:
My questions:
1) Was this a part of TFS 2010 and I am just not remembering seeing it?
2) If this IS part of TFS 2010, how to enable this option (it is disabled).
3) If this is NOT a part of TFS 2010, how did it get there?
Yes, it is part of TFS 2010, but I have no idea how it got here!
I believe this is for those who use TFS 'as a service' (when you
have no file share to copy it to). According to
how-can-i-copy-build-output-to-the-source-control-folder
I have this in TFS/VS 2010 (SP1):

Changeset Number into Version Info with hosted TFS

We're using Team Foundation Service instead of a local TFS.
Our solution was created on Visual Studio 2012.
My problem is now that we want all assemblies to have the same version number (this part is already solved by using a CommonAssemblyInfo.cs that is linked into all projects).
The issue I'm facing right now is that we need the tfs changeset number at the last digit of the assembly version (e.g. 1.0.0.4711 where 4711 is the changeset number).
I've found several examples, but none of them worked for me.
And yes, I especially searched here on stackoverflow a lot.
I also have to admit that I've never looked into the MSBuild scripts...
Can anyone please give me a hint on how to accomplish this?
Is it for example possible to use the MSBuild Extension Pack on Team Foundation Service (not local TFS) and if, how to do that?
As always, time is my worst enemy...
Note that from 2010 Tfs employs Windows workflow for building the package the workflow calls msbuild for compiling the projects only - while its possible to pass changeset this way to msbuild its rather more hops.
Following deals with your problem, however the linked solution is more complex that needed:
Can assembly version been automatically updated with each TFS 2010 Build?
This is one of best series of tutorials on the custom build activities, the author is on stack as well i believe, one specificly about versioning
http://www.ewaldhofman.nl/post/2010/05/13/Customize-Team-Build-2010-e28093-Part-5-Increase-AssemblyVersion.aspx
In short you need a custom activity to run before compilation on source files, find all CommonAssemblyInfo.cs files, feed this list to your custom activity, it modifies the values inside with passed value of full version number or only the changeset and optionaly check in the change (probably not since your changeset will be out of sync then).
You can also take a look at https://tfsbuildextensions.codeplex.com/ set of activities there is TfsVersion activity among them, at the very least it will provide examples.
Functionality need for this should be available through Team Explorer and source control - The Custom activity assemblies and build templates usually are located in folder in your team project root - the location of this folder is defined for build controller you can change this through team explorer build section.
Changeset is available from value BuildDetail.SourceGetVersion, not sure if this was fixed/changed in 2012 however there were 2 issues about this value in 2010
Its doesnt respect GetVersion override in default build template - you will manualy need to update if override is used
When running latest build (no override) it will get the last changeset number from tfs - depending on your branches this may not be the same as 'last' changeset for the branch of build. You will either have to live with this, provide overrides for each build or implement activity that checks branch history for last changeset value and overrides it again.
It should be noted that GetVersion should be able to accept any sourcespec version - changeset, date, label etc. I havent played around with this enough to provide more details to you.
Colin Dembovsky wrote a great overview of doing version embedding using the new pre-build script setting in TFS 2013 build definitions.
The Changeset number is easily accessible within the pre-build process in the environment variable TF_BUILD_SOURCEGETVERSION. I was able to use this to embed the Changeset value in our binaries using a script based on Dembovsky's work above. (I used Perl, not powershell, so you probably don't want to see it ;-)
This approach doesn't require any changes to the build workflow which makes it a big win for me.
I've used Wintellect's solution - MSBuild-only, no TFS magic needed. I also added to the auto-generated CSharp file:
[assembly:AssemblyInformationalVersion("$(BuildNumber)")]
So I get the TFS build number.

Can a branch be made from a previous changeset?

I need to create a branch at a specific Changeset in TFS. Is this doable?
For example, I have changeset 1528 that was the last check in on my project. But I want to branch from changeset 1487. Can this be done?
If so, how?
Note: I am using TFS 2008
Yes. When a branch is created you can choose the historical point in time when it takes effect (date, changeset, etc).
See Visual Studio TFS Branching and Merging Guide for some great information on recommended branching practices.
Or How to: Branch Files and Folders (MSDN) for more explicit instructions on getting this dialog up to create a branch.
Visual Studio 2010 and later added support for this functionality:

Resources