Issues with build in Team foundation server 2013

 This post is to provide details a bug which was reported in Team Foundation Server 2013 build and confirmed by the build product team. Please find the details below:

 In the GUI for a build definition you can enter a set of platforms and configurations to build, but I can be left empty to build what the solution/project to be built specifies. You can also chose to enter only one of them. I.e. build for Release but let the solution define the platform mix of X86, X64 etc. where needed.

 This is entered as separate Configuration and Platform in the GUI

 

 

but gets passed on in inverse order in a string as

 <platform>|<configuration>

 

 

The method below I used when composing the MSBuild command line and causes this to fail since it uses the Split parameter StringSplitOptions.RemoveEmptyEntries and then assumes that the first value in the list (if any) is platform and the second (if any) is Configuration which obviously is not true when Platform is intentionally left blank.

 

namespace Microsoft.TeamFoundation.Build.Workflow.Activities

{

    /// <summary>Represents the pair of platform and configuration that a solution or project is built against.</summary>

 

     <snip>

        public static PlatformConfiguration FromString(string platformConfiguration)

        {

            if (string.IsNullOrEmpty(platformConfiguration))

            {

                return PlatformConfiguration.Default;

            }

            string[] strArrays = new string[] { "|" };

            string[] strArrays1 = platformConfiguration.Split(strArrays, StringSplitOptions.RemoveEmptyEntries);

            PlatformConfiguration platformConfiguration1 = new PlatformConfiguration(string.Empty, string.Empty);

            if ((int)strArrays1.Length > 0)

            {

                platformConfiguration1.Platform = strArrays1[0];

            }

            if ((int)strArrays1.Length > 1)

            {

                platformConfiguration1.Configuration = strArrays1[1];

            }

            return platformConfiguration1;

        }

 

         <snip>

    }

}

 

Echoes of this bug can be seen in the GUI when opening such an entry for the second time and the values move around.

 

 

As per build product team, It should be fixed in the next cumulative update

 

Resolution/Workaround

 If you are seeing such bugs being reported, the workaround might be to specify the platform or configuration values on the MSBuild command line manually. That resolved the issue for my customer

 

Written and Reviewed by Nitish Nagpal, Support Escalation Engineer