Jaa


Upgrading your build definitions from TFS2010 to TFS2012

There have been a lot of problems with compatibility of custom builds when upgrading from TFS2010 to TFS2012. This blog post is my attempt to summarize what you have to do and how to fix some issues you might run into.

  1. The very first step is to upgrade your Server. Your build machines should match the version of your server.
  2. To upgrade your build machine to TFS2012 follow the instructions on
    https://msdn.microsoft.com/en-us/library/jj620928.aspx
  3. If you need Visual Studio on the build machine, install VS 2012 on the build machine. You will probably want to keep VS2010 on the build machine as well. This shouldn't cause any problems.
  4. The next step is to recompile any custom activity assemblies that this build machine uses to target the 4.5 .net framework and the version 11.0.0.0 Team Foundation assemblies.
    1. Open the solutions for your custom activities
    2. Open Properties on each project and change the target framework to 4.5
    3. Remove all TeamFoundation references and replace them with the ones that ship with Visual Studio 2012 (the version number should be 11.0.0.0 - NOT 10.0.0.0).
    4. Recompile the solutions and check in the binaries to the custom assembly location
    5. ALL assemblies in the custom assembly location for a 2012 controller should be compiled against the 11.0.0.0 versions of the TeamFoundation assemblies.
  5. The final step before testing your builds is to "clean up" any versioned namespaces in your Build Process Templates (XAML files)
    1. locate all of your XAML files - these are usually in $/TeamProject/BuildProcessTemplates
    2. for each XAML file: check it out, clean it by removing versioned namespaces, and check it back in (see https://blogs.msdn.com/b/jpricket/archive/2012/07/17/tfs-2012-cleaning-up-workflow-xaml-files-aka-removing-versioned-namespaces.aspx)
  6. Finally, you should be able to test your build definitions.

Limitations

  • A 2010 Build machine will NOT work with a 2012 Team Foundation Server
  • A 2012 Build machine will NOT work with a 2010 Team Foundation Server
  • A 2012 Build machine cannot build a 2010 template that contains versioned namespaces that reference 10.0.0.0 assemblies
  • A 2012 Build machine cannot build a 2010 template that calls out to custom activities that are compiled against 10.0.0.0 Team Foundation Assemblies
  • Build Definitions that reference custom types may not be editable in both Visual Studio 2010 and 2012
    • It's hard to identify all the combinations here, but if loading your custom types causes Team Foundation assemblies of the wrong version to be loaded then the editor will not work as desired.
    • Note that in Visual Studio 2012, you should be able to edit other parts of the definition, just not the process parameters that cause errors.

Problems you might face and workarounds:

  • After upgrading your templates and custom assemblies as described above, you will only be able to edit them in Visual Studio 2012.
  • If you install both Visual Studio 2010 and 2012 on the same machine, make sure you install them in that order: 2010 and then 2012.
    • Opening a template in the VS 2010 Worflow Designer on this machine will not work without changes to the template. It will attempt to load the 2012 Team Foundation assemblies as well as the 2010 versions which will cause errors when it tries to evaluate any types. There's really nothing wrong with the actual template.
    • If you have to have the designer working in 2010 on a machine with 2012 installed, you can change the namespaces in the XAML file to use the full assembly name including the version information. But I wouldn't recommend this, since it will have to be removed for the template to work in 2012.
    • The 2012 Workflow Designer should work fine if you followed the steps above to "clean" the XAML
  • If you get the following error when building your definitions against a recently upgraded build machine, you should restart your build machine service from the TF Admin Console on the build machine.
    • TF215097: An error occurred while initializing a build for build definition \Project1 (Dev10)\Simple - Manual: The values provided for the root activity's arguments did not satisfy the root activity's requirements:
      'DynamicActivity': Expected an input parameter value of type 'Microsoft.TeamFoundation.Build.Workflow.Activities.BuildSettings' for parameter named 'BuildSettings'.
    • I am not sure what caused this error when I did it, but the fix was pretty simple once I figured it out.
    • UPDATE: Several customers have continued to get this error after upgrading even though they restarted their build service. It turns out that these customers had fixed most of their custom assemblies but not all. If you continue to see problems like this one (even intermittently), it means that there is still a build definition that uses assemblies/activities that are compiled against the 10.0.0.0 assemblies. Once the error starts, all subsequent builds fail because the old assemblies are loaded into the build services memory. Only restarting will resolve this issue.
  • If you get the following error, you didn't update ALL your custom assemblies to reference the 11.0.0.0 versions of the TF assemblies.
    • TF215097: An error occurred while initializing a build for build definition \Project1 (Dev10)\Advanced - Manual: The root element of the build process template found at $/Project1 (Dev10)/MyActivities/MyActivities/AdvancedBuildProcessTemplate.xaml (version C42) is not valid. (The build process failed validation. Details:
      Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error:   Compiler error(s) encountered processing expression "DropBuild AndAlso BuildDetail.Reason = Microsoft.TeamFoundation.Build.Client.BuildReason.ValidateShelveset".
      Type 'IBuildDetail' is not defined.
  • If you get any errors like these, the XAML file probably still contains some versioned namespaces.
    • TF215097: An error occurred while initializing a build for build definition \Project1 (Dev10)\Moderate - Manual: The root element of the build process template found at $/Project1 (Dev10)/BuildProcessTemplates/ModerateBuildProcessTemplate.xaml (version C31) is not valid. (The build process failed validation. Details:
      Validation Error: Compiler error(s) encountered processing expression "New Microsoft.TeamFoundation.Build.Workflow.Activities.BuildSettings()".
      'BuildSettings' is ambiguous in the namespace 'Microsoft.TeamFoundation.Build.Workflow.Activities'.
      Validation Error: Compiler error(s) encountered processing expression "Microsoft.TeamFoundation.Build.Workflow.Activities.CleanWorkspaceOption.All".
      'CleanWorkspaceOption' is ambiguous in the namespace 'Microsoft.TeamFoundation.Build.Workflow.Activities'.

Comments

  • Anonymous
    October 24, 2012
    Jason, thanks, it clears up a lot of the confusion :). Or at least explains why it is confusing.

  • Anonymous
    October 24, 2012
    Don't forget that binding redirects work in some cases. This is especially helpful if you are unable to recompile your custom assemblies to v11. blogs.msdn.com/.../your-custom-assemblies-need-update-or-else-redirecting.aspx Quote: "Since we’ve maintained public APIs compatibility between releases, this approach should just work. You should be aware that this configuration will not let you load any other version of the redirected assemblies." The change in TfsBuildServiceHost.exe.config will look similar to this: <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Microsoft.TeamFoundation.Build.Client" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <bindingRedirect oldVersion="10.0.0.0" newVersion="11.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.TeamFoundation.Build.Workflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <bindingRedirect oldVersion="10.0.0.0" newVersion="11.0.0.0"/> </dependentAssembly> </assemblyBinding>

  • Anonymous
    October 25, 2012
    Just to be clear: does this mean that if we need a 2012 build machine (to take advantage of the 2012 C++ compiler) we must first take steps to migrate from TFS 2010 to TFS 2012?   We were hoping to incrementally move to 2012 by moving developer machines and build machines first before tackling the issue of migrating our 2010 TFS to 2012.  I just need to be super clear on this because it has the potential to drastically change our approach to 2012 adoption.

  • Anonymous
    October 25, 2012
    Hi David, Clarity: For all versions of TFS up to and including TFS 2012, the version of the build machine MUST match the version of the TFS server that it communicates with. So, YES you have to upgrade your server and your build machines at the same time. We are trying to decouple the server and build machines, but it hasn't happened yet. Sorry for the bad news, Jason

  • Anonymous
    December 11, 2012
    I get the TF215097 dynamic activity error all the time. I restart the build service and it goes away for a little bit, but then it comes back. Annoyingly, it didn't do this when I set this up in my test environment.

  • Anonymous
    December 11, 2012
    Most likely, you have some XAML or custom assemblies that have not been upgraded. Once those builds are run, subsequent builds will be "contaminated". Try looking for the builds that cause the error or perhaps the ones that succeed just before you see the error. Jason

  • Anonymous
    January 09, 2013
    Hi Jason, I'm trying to upgrade a highly customized build process that uses the Community TFS Build Extensions from VS2010 to VS2012, keeping TFS2010 as the base.  Following your recipe I've been able to get it to the point that the XAML designer isnt complaining - however, I'm still unable to get a clean build.   It complains: Unrecognized tag 'x:Members' in namespace 'schemas.microsoft.com/.../xaml&..... for 3 of the 4  XAMLs that are included in the solution. In reference to your recipie:

  1. We are staying with TFS2010 for now.
  2. n/a – we’re not upgrading to TFS2012
  3. We have installed (only) VS2012 on the developer and build machines
  4. I’ve upgraded the build extentions to the latest release (which includes VS2012 compatible binaries), and changed all the references to the VS2012 versions 4a. … 4b. Framework is at 4.5 4c. I have no references to TFS v10 DLLs – all are the v11 DLLs that ship with VS2012 4d. (this is the step that results in the error) 4e. Have to assume the release of TFSBuild Extentions is solid this way
  5. All XAMLs have passed the XAMLCleaner It’s the Step 4d that is still failing…   Any suggestions you can offer would be appreciated
  • Anonymous
    January 10, 2013
    XAML activities can be tricky. I am not sure what's wrong with yours, but open them up in notepad and compare them to the one that works. Good luck, Jason

  • Anonymous
    February 05, 2013
    please vote on the uservoice page: visualstudio.uservoice.com/.../3288596-to-allow-the-usage-of-build-controller-2010-with-t

  • Anonymous
    February 06, 2013
    I'm confused - if we use TFS 2010, can we have one build server that builds VS 2010 solutions and another that builds VS 2012 solutions?  I gather the build server itself is still a 'TFS 2010' build server, but only has Visual Studio 2012/.NET 4.5 installed and will only be building 2012 solutions. But then if we want to upgrade to TFS 2012, what happens to the build server that's needed to build VS 2010 solutions?  Can TFS 2012 build server still be dedicated to only building VS 2010 solutions? Basically, the build server for VS 2010 solutions needs to be impacted as little as possible so we can build patches etc. for our existing products with no risk - I certainly wouldn't want to put .NET 4.5 on it. Thanks.

  • Anonymous
    February 13, 2013
    Hi Dylan, We are working on a solution for this problem. The "upgrade" of .net from 4.0 to 4.5 is causing many customers problems and keeping them from upgrading. We hope to have a solution soon. Thanks for letting us know how you use the product. Jason

  • Anonymous
    April 03, 2013
    Jason, we have a 2010 server in the corporation but use visual studio 2012 in our group to develop. Can I setup a team build for our project or do I have to wait till they upgrade to TFS Server 2012? I setup a tfs 2010 controller on a VM but it's not going smoothly.

  • Anonymous
    April 03, 2013
    I have already upgraded to TFS2012 on my tfs server and when I try to follow the below step  as you mentioned The next step is to recompile any custom activity assemblies that this build machine uses to target the 4.5 .net framework and the version 11.0.0.0 Team Foundation assemblies.    Open the solutions for your custom activities    Open Properties on each project and change the target framework to 4.5 The target framework 4.5 is not listed in the dropdown for the project properties and also I dont see v4.5 on the path C:WindowsMicrosoft.NETFramework64 of my server . Please can you help  I am using Cutom template and my builds are failing

  • Anonymous
    May 02, 2013
    I'm getting this trying to edit any XAML file. Google shows nothing at all for this error... System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.SharePoint.WorkflowExtensions, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.VisualStudio.SharePoint.WorkflowExtensions, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Server stack trace:   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, etc.   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)   at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm)   at System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage.FixupForNewAppDomain()   at System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage(IMessage reqMsg)

  • Anonymous
    May 07, 2013
    Actually we've upgraded to Update 2 now, which is supposed to be able to support xaml build process files and custom activities built for TFS 2010 right? Even on a TFS 2012 build server?  Getting different errors now...

  • Anonymous
    May 09, 2013
    @DanGros If you are using VS2012, you should be able to work with an older server. However, you will probably have to figure out how to get VS2012 on your build machine to build anything that targets the latest .net framework. This may include pointing the MSBuild activity to the new framework's MSBuild.exe. I am really not sure what other problems you might right into. Good Luck, Jason

  • Anonymous
    May 09, 2013
    @RiyankaDaga   Are you using Visual Studio 2012? The .net 4.5 framework should be the latest one if you have VS 2012 installed. Sorry, I couldn't help more. Jason

  • Anonymous
    May 09, 2013
    Hi Dylan, I am not sure if everything "just works". The change in Update 2 was to allow 2010 build machines to run against a 2012 server. Hopefully, you will get your errors worked out. Good Luck, Jason

  • Anonymous
    May 09, 2013
    We recently upgraded our TFS to 2012 and we are getting error tf14064 and we are unable to figure out whythis is. Any help would be appreciated.

  • Anonymous
    May 10, 2013
    Hi John, this is better handled by support. I am not sure why you would get that error after upgrading.

  • Anonymous
    May 11, 2013
    We are getting the following error when trying to run our Builds from an upgraded TFS 2010 server to TFS 2012.3 RC. specified argument was out of the range of valid values. Parameter name: column. We are using our TFS 2010, yes 2010, Build Controller and 2010 Build agents (installed on SRV 2003 so can't install 2012) against our newly upgrade TFS 2012.3 server. Again we have upgraded to 2012.3 and are trying to use the build backward compatibility was released with TFS 2012.2 (update 2)  Here is a screen shot: http://i.imgur.com/Ze1bpPQ.png

  • Anonymous
    May 13, 2013
    We are getting the exact same error about "out of range of valid values. Parameter name: column" Does anyone have any ideas on this.  Again, we have 2010 build agents and controllers and TFS 2012 with latest updates.

  • Anonymous
    May 14, 2013
    Hi Scott and Trent, This is a known bug that we discovered near the end of development for TFS 2012.3. However, we did include it in the final version of Update 3. If you still experience the error after you get the final version of Update 3, please file a bug against TFS on Microsoft's Connect site. The only workaround in the mean time is to turn off the UpdateWorkItems flag on the AssociateChangesetsAndWorkItems activity. This will cause workitems not to be associated with the build. Sorry we didn't catch this bug sooner. Thanks, Jason

  • Anonymous
    May 27, 2013
    Yep, when upgrade TFS 2010 to 2012 update 2, we got the same error "out of range of valid values" as well. We did the same workaround by turning off AssociatedChangeset and let the build succeed once. After that, we turn it back on and everything work as normal. Say if MS fix this in Update 3, which we don't want to upgrade right away. We have a lot of customization and it costs a lot of time to test and validate the system, especially builds. Hopefully, we will go directly to 2013 sometime.

  • Anonymous
    May 27, 2013
    By the way, we have alot of Server 2003 and we still stuck alot of Build Service 2010. We will have to upgrade to Server 2008 next before looking for future TFS.

  • Anonymous
    January 27, 2014
    Recently my TFS moved from TFS2008 to TFS2013 and my projects are still in VS2010 and .net 4.0. By reading your post, is not possible to use VS2010 and .net 4.0 projects with TFS2013 and migrate the old build definitions to the new TFS2013? The projects must upgrade to VS2012 and .net 4.5 and create new builds definitions, yes? Best regards.

  • Anonymous
    February 20, 2014
    The TFS 2013 server supports talking to the 2010 Build Machines to build 2010 solutions and projects. Thanks, Jason

  • Anonymous
    August 03, 2015
    I have a customized 2010 Build Template. Is it possible for me to convert this template to 2012 template? If so how can I do it?

  • Anonymous
    August 05, 2015
    @Chirag The best approach is to diff your changes with the 2010 template and then see how those same changes can be made to the 2012 template. We don't have any way to simply migrate it to 2012. That said, the 2010 template can be made to work on 2012 as is. Thanks, Jason

  • Anonymous
    September 01, 2015
    We are running TFS 2010 and just recently upgraded a test build machine to run .net 4.5.2 with TFS 2010. This required us to install VS 2012 and now when we are running our 2010 build definition, we fail with this error among others related to other work item types. The build process failed validation. Details:  Validation Error: The private implementation of activity '1: DynamicActivity' has the following validation error:   Compiler error(s) encountered processing expression "wit.Project.Name = "Support"". Type 'WorkItem' is not defined. I have narrowed this down a build activity called If AssociateChangesetsAndWorkItems. if I remove this activity, the build is successful, if it is there, it fails. Under the VS/TFS 2010 build machine, it works fine with the If AssociateChangesetsAndWorkItems activity in place. Under the VS2012/TFS 2010 build machine, it fails with the If AssociateChangesetsAndWorkItems activity in place, but works if it is removed. Ideas?