<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Brandon's Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/brandonhawbaker/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/brandonhawbaker/feed.xml</link>
    <description>I&amp;#039;m a developer for build and deployment automation for OEMIT at Microsoft.</description>
    <lastBuildDate>Wed, 17 Apr 2019 04:10:52 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Team Foundation Server 2010 - Managing TFS Build Drop Location</title>
      <link>https://docs.microsoft.com/archive/blogs/brandonhawbaker/team-foundation-server-2010-managing-tfs-build-drop-location</link>
      <pubDate>Thu, 07 Apr 2011 19:10:00 GMT</pubDate>
      <dc:creator><![CDATA[Brandon Hawbaker]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/brandonhawbaker/2011/04/07/team-foundation-server-2010-managing-tfs-build-drop-location/</guid>
      <description><![CDATA[Discussion Items:


Overview 


TFSBuild DropLocation


Calling TFSBuild Activity...]]></description>
      <content:encoded><![CDATA[<p><span style="color: #008080;"></span></p>
<h3><span style="font-family: 'Verdana', 'sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Discussion Items:</span><span style="font-family: 'Verdana', 'sans-serif'; color: black; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></h3>
<ul>
<li>
<div class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; COLOR: black; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><strong><span style="font-family: 'Verdana', 'sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Overview</span></span></strong><span style="font-family: 'Verdana', 'sans-serif'; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span></div>
</li>
<li>
<div class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; COLOR: black; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><strong><span style="font-family: 'Verdana', 'sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">TFSBuild DropLocation</span></span></strong></div>
</li>
<li>
<div class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; COLOR: black; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><strong><span style="font-family: 'Verdana', 'sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Calling TFSBuild Activity Multiple Times</span></span></strong></div>
</li>
<li>
<div class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; COLOR: black; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><strong><span style="font-family: 'Verdana', 'sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Preventing DropLocation Corruption</span></span></strong></div>
</li>
<li>
<div class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; COLOR: black; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><strong><span style="font-family: 'Verdana', 'sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Conclusion</span></span></strong></div>
</li>
</ul>
<p class="MsoNormal"><strong><span style="font-family: 'Verdana', 'sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;"></span></span></strong></p>
<h2 class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="color: #008080;">Overview</span></h2>
<h2 class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="color: #008080;"></span></h2>
<p class="MsoNormal">In Team Foundation Server 2010 (TFS2010), the UpgradeTemplate.xaml allows you to call a TFSBuild custom workflow activity that utilizes&nbsp;the same build scripts, properties, etc. used in Team Foundation Server 2008 (TFS2008)&nbsp;&nbsp;to compile your projects and solutions.&nbsp; You may find yourself wanting to make different versions of the UpgradeTemplate.xaml to be able to make multiple calls&nbsp;of theTFSBuild workflow activity within the same build, and may wonder how you can leverage the same drop location.&nbsp; As you will see, this requires a little extra work than you might expect.&nbsp;</p>
<h2 class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; COLOR: ; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/5100.TFSBuildActivity.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/5100.TFSBuildActivity.PNG" border="0" /><img height="361" width="256" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/0028.TFSBuildActivityProperties.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/0028.TFSBuildActivityProperties.png" border="0" /></h2>
<p class="MsoNormal">&nbsp;</p>
<h2 class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; COLOR: ; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><span style="color: #008080;">TFSBuild DropLocation</span></h2>
<h2 class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; COLOR: ; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><span style="color: #008080;"></span></h2>
<p class="MsoNormal">When writing team build scripts in Team Foundation Server 2008 (TFS2008), we relied on the $(DropLocation) property to know where to handle the output of the build. For example, we may copy various 3rd party assemblies there, do some configuration file changes, restructure the output, and any variety of changes to this final build location.&nbsp; By default, the drop location&nbsp;starts off as the&nbsp;share location passed in to the queue build window:&nbsp;</p>
<p class="MsoNormal"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/3884.DropLocationStart.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/3884.DropLocationStart.PNG" border="0" /></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">The&nbsp;DropLocation property is captured internally and created within the Microsoft.TeamFoundation.Build.targets file (i.e. C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets).&nbsp; So when the DropLocation is first constructed it starts with <a href="file://\\server\share">\\server\share</a>&nbsp;and is pulled from the TFS database using the GetBuildProperties custom task within the <span style="color: #0000ff;">InitializeBuildProperties</span> target:</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;<img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/6472.GetBuildProperties.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/6472.GetBuildProperties.PNG" border="0" /></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">You can override the build number that gets added to the end of the original drop location using the skeleton target&nbsp;<span style="color: #0000ff;">BuildNumberOverrideTarget</span>&nbsp;that gets called after initializing these properties, but before concatenating the original $(DropLocation) property&nbsp;with the $(BuildNumber) property forming the new updated $(DropLocation) property:&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/0028.OverrideBuildNumber.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/0028.OverrideBuildNumber.PNG" border="0" />&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">In the <span style="color: #0000ff;">InitializeEndToEndIteration </span>MSBuild target, the original $(DropLocation) is added to the $(BuildNumber) and is then updated in the TFS database:</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;<img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/4135.UpdateDatabase.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/4135.UpdateDatabase.PNG" border="0" /></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;This is how your first build of the day would end up with the $(DropLocation) property being: <a href="file://\\server\share\MyBuildDefinition_20110407.1">\\server\share\<span style="background-color: #ffff00;">MyBuildDefinition_20110407.1</span></a>.&nbsp; The $(BuildNumber) piece is the part in yellow.</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><strong>Updating Drop Location Using Internal Targets</strong></p>
<p class="MsoNormal"><strong></strong>&nbsp;</p>
<p class="MsoNormal">In MSBuild scripts, you can update the&nbsp;final drop location by either overriding the <span style="color: #0000ff;">BuildNumberOverrideTarget</span> and creating&nbsp;different properties like this:<br />(in TFSBuild.proj or other imported&nbsp;.proj file)</p>
<p class="MsoNormal"><br /><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/3326.OverrideBuildNumberExample.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/3326.OverrideBuildNumberExample.PNG" border="0" /></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">Since my team project is <span style="background-color: #ffcc99;">brandoh</span>, this would create a droplocation such as:&nbsp; <a href="file://\\server\share\MyBuildDefinition_20110407.1">\\server\share\<span style="background-color: #ffcc99;">brandoh_</span><span style="background-color: #ffff00;">MyBuildDefinition_20110407.1</span></a>&nbsp;&nbsp;.&nbsp; </p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><strong>Updating Drop Location Using Custom&nbsp;C# Tasks</strong>&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">The next challenge might come if you want to do some sort of special modification to the droplocation utilizing values derived from some custom task that you wrote.&nbsp; In this case, this may not work because the assemblies containing your custom tasks will not exist in the workspace yet, because these internal targets take place <strong>before</strong> the get (before downloading files from source control).&nbsp; In this case you need to update the drop location registered in the database, <strong>after </strong>the get.</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">You may have noticed the <span style="color: #0000ff;">AfterGet <span style="color: #000000;">target skeleton target, which is an empty target that you can override which gets called in the Microsoft.TeamFoundation.Build.targets file.&nbsp; Since, I have shown some example custom targets to run (<span style="color: #0000ff;">RunTarget1</span>, <span style="color: #0000ff;">RunTarget2</span>, and <span style="color: #0000ff;">RunTarget3</span>), I will use <span style="color: #0000ff;">RunTarget1</span> to demo how to perform an additional custom update:</span></span></p>
<p class="MsoNormal"><span style="color: #0000ff;"><span style="color: #000000;"></span></span>&nbsp;</p>
<p class="MsoNormal"><span style="color: #0000ff;"><span style="color: #000000;"></span></span></p>
<p class="MsoNormal"><span style="color: #0000ff;"><span style="color: #000000;"></span></span>&nbsp;<img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/0804.AfterGetDropLocationModification.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/0804.AfterGetDropLocationModification.PNG" border="0" /></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">Basically, I got today's date and created a new date-based folder to store builds in and then updated the database with the new drop location.&nbsp; </p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span style="color: #ff0000;">Important</span>: You may wonder why the $(DropLocation) property is the original droplocation in this context and not the one modified earlier in the <span style="color: #0000ff;">InitializeEndToEndIteration </span>target.&nbsp; The answer to this question is somewhat complex, but basically, custom properties only have a scope that pertains to the group of targets within a DependsOnTargets target.&nbsp; Using the <span style="color: #0000ff;">AfterGet</span> example above, the <span style="color: #0000ff;">RunTarget2</span> and <span style="color: #0000ff;">RunTarget3</span> targets will have access to custom properties created in <span style="color: #0000ff;">RunTarget1</span>, but no other targets will have access to any other property of other MSBuild.exe target calls, unless they are passed in internally via the command-line (i.e. msbuild.exe targets.proj /p:DropLocation=[ModifiedDropLocation]) or through an MSBuild custom task call.&nbsp; When Team Build re-enters it's own internal targets, it loses scope of modified properties not pulled again from the database.</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span style="color: #008000;">Solution</span>: So how do you gain access to modified properties when they lose scope through-out different portions of the build?&nbsp; This is a great question!&nbsp; What I recommend as a possible solution to this is to have&nbsp;a simple <span style="color: #0000ff;">InitializeVariables </span>target that you call at the beginning of all DependsOnTargets target lists like this:</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;<img height="361" width="900" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com//00/00/34/52/22/Attached%20Files/1030.RefreshingProperties.PNG" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Components-UserFiles/00-00-34-52-22-Attached+Files/1030.RefreshingProperties.PNG" border="0" /></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">As you can see, when the build stops compiling solutions/projects, Team Build calls the AfterDropBuild target which will start by running the <span style="color: #0000ff;">InitializeVariables </span>target to setup any custom properties derived from custom tasks.&nbsp; Now, these properties will exist in their correct form throughout all other targets in that DependsOnTargets attribute (<span style="color: #0000ff;">RunTarget4</span>, <span style="color: #0000ff;">RunTarget5</span>, and <span style="color: #0000ff;">RunTarget6</span>).</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><strong>CustomPropertiesForBuild: </strong>You might be wondering what this property is.&nbsp; This property is an internal property that when you group your property = value semi-colon delimited pairs within it (i.e.&nbsp; a=1;b=2;c=3, etc.), that property gets passed throughout many of the internal targets&nbsp;via msbuild calls (i.e. BeforeCompileSolution, AfterCompileSolution, etc.) and makes them even more available.</p>
<p class="MsoNormal">&nbsp;</p>
<h2 class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="color: #008080;">Calling TFSBuild Activity Multiple Times</span></h2>
<h2 class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="color: #008080;"></span></h2>
<p class="MsoNormal">Everything discussed so far also applies to TFS2008 as well as the UpgradeTemplate in TFS2010.&nbsp; So what happens if you want to create a new version of the UpgradeTemplate.xaml in TFS2010, where you call the TFSBuild workflow activity more than once?&nbsp;&nbsp;(i.e. when trying to run different builds in parallel or trying to run&nbsp;TFSBuild multiple times in the same build but in different ways each time)</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;<img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/0447.MultipleTFSBuildActivities.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/0447.MultipleTFSBuildActivities.PNG" border="0" /></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">What happens is that the DropLocation will get corrupted, because it will retrieve the current value in the database and then use it to create a new value appending the build number <strong><em>again</em></strong>.&nbsp; You will start seeing repeating build numbers like this:&nbsp;&nbsp; <a href="file://\\server\share\MyBuildDefinition_20110407.1">\\server\share\<span style="background-color: #ffffff;">brandoh_MyBuildDefinition_20110407.1</span>\<span style="background-color: #ffffff;"><span style="color: #0066cc;">brandoh_MyBuildDefinition_20110407.1\</span></span></a><a href="file://\\server\share\MyBuildDefinition_20110407.1"><span style="background-color: #ffffff;">brandoh_MyBuildDefinition_20110407.1</span></a>.<a></a></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a></a></p>
<p class="MsoNormal"><a></a></p>
<p class="MsoNormal"><a></a><a></a></p>
<p class="MsoNormal"><span style="background-color: #ffffff;"><span style="color: #0066cc;"><span style="background-color: #ffffff;"></span></span></span></p>
<h2 class="MsoNormal"><span style="background-color: #ffffff;"><span style="color: #0066cc;"><span style="background-color: #ffffff;"></span></span></span><span style="color: #008080;">Preventing DropLocation Corruption</span></h2>
<h2 class="MsoNormal"><span style="color: #008080;"></span></h2>
<h2 class="MsoNormal"><span style="color: #008080;"></span></h2>
<h2 class="MsoNormal"><span style="color: #008080;"></span></h2>
<p class="MsoNormal">There is hope!&nbsp; One way to prevent DropLocation corruption is by first capturing the "original" droplocation before adding the build number and then passing it into the TFSBuild workflow activity teaching it to correctly determine it's droplocation based on what was passed in,<strong> NOT </strong>based on what is internally pulled from the database.</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">Before we can pass in the original drop location into the TFSBuild activity we first need to get the original droplocation in the workflow.&nbsp; You can create a variable to capture the original drop location:</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><img height="135" width="359" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/2022.OriginalDropLocationVariable.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/2022.OriginalDropLocationVariable.PNG" border="0" /></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">Then use the assign activity assign it the value of <strong>BuildDetail.DropLocationRoot</strong> at the beginning of the build:</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><img height="239" width="461" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/0601.GetOriginalDropLocation.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/0601.GetOriginalDropLocation.PNG" border="0" />&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">Then you will need to pass this value into the TFSBuild workflow activities you want to consider this original droplocation:</p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><img height="302" width="289" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/1464.MSBuildSetting.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/1464.MSBuildSetting.PNG" border="0" /></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;<img height="153" width="470" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/8204.PassingOriginalDropLocation.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/8204.PassingOriginalDropLocation.PNG" border="0" /></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">Then you can change your msbuild code for <span style="color: #0000ff;">RunTarget1 </span>to set the droplocation based on whether or not this value is passed in.&nbsp; As you can see, if the droplocation property is empty, it means the value wasn't passed in, so we can let the build update as normal (see <span style="color: #0000ff;">RunTarget1 </span>above to compare).&nbsp; If it's not empty, we can use the OriginalDropLocation value to correctly set the droplocation rather than use the value that is pulled internally from the database in the Microsoft.TeamFoundation.Build.targets file:&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>
<h2 class="MsoNormal" style="LINE-HEIGHT: normal; MARGIN: 0in 0in 10pt; COLOR: ; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/8877.SettingDropLocationConditionally.PNG" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/8877.SettingDropLocationConditionally.PNG" border="0" /></h2>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">&nbsp;</p>
<h2 class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="color: #008080;">Conclusion</span></h2>
<h2 class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><span style="color: #008080;"></span></h2>
<p>By leveraging the principles discussed in this blog you can effectively manage the drop location in a variety of ways, including reflecting the desired drop location in multiple TFSBuild workflow activities.&nbsp; The ability to utilize the same drop location in different workflow activities lets you utilize modified versions of the UpgradeTemplate.xaml to employ parallel build activities or to engage entire build processes sequentially but in different ways.&nbsp; </p>
<p>&nbsp;</p>
<p>In the future, if I get a chance, I will try and show how you can do some really cool parallel build processes. ;-)</p>
<p class="MsoNormal">&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Team Foundation Server 2010 Team Build Workflow</title>
      <link>https://docs.microsoft.com/archive/blogs/brandonhawbaker/team-foundation-server-2010-team-build-workflow</link>
      <pubDate>Fri, 25 Mar 2011 15:31:00 GMT</pubDate>
      <dc:creator><![CDATA[Brandon Hawbaker]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/brandonhawbaker/2011/03/25/team-foundation-server-2010-team-build-workflow/</guid>
      <description><![CDATA[&nbsp;

Discussion Items:

Overview 
Default Template vs. Upgrade Template 
Template...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p>
<p class="MsoNormal"><strong><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"></span></strong></p>
<p class="MsoNormal"><strong><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Discussion Items:</span></strong><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<ul type="disc">
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: black; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Overview</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: black; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Default Template vs. Upgrade Template</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: black; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Template Parameters</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span>
<ul type="circle">
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: #003366; tab-stops: list 1.0in; mso-list: l0 level2 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Multiple Build Definitions Using One Template</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: #003366; tab-stops: list 1.0in; mso-list: l0 level2 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Adding Your Own Parameters</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></li>
</ul>
</li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: #003366; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Workflow Architecting</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span>
<ul type="circle">
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: #003366; tab-stops: list 1.0in; mso-list: l0 level2 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Executing Commands </span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: #003366; tab-stops: list 1.0in; mso-list: l0 level2 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Display Logging</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: #003366; tab-stops: list 1.0in; mso-list: l0 level2 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Variables</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: #003366; tab-stops: list 1.0in; mso-list: l0 level2 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Conditioning</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: #003366; tab-stops: list 1.0in; mso-list: l0 level2 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Looping</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: #003366; tab-stops: list 1.0in; mso-list: l0 level2 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Sequence</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: #003366; tab-stops: list 1.0in; mso-list: l0 level2 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Flowchart</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: #003366; tab-stops: list 1.0in; mso-list: l0 level2 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Parallel</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></li>
</ul>
</li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: #003366; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Imports</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: #003366; tab-stops: list .5in; mso-list: l0 level1 lfo1; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto;"><strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><span style="color: #003366; text-decoration: none; text-underline: none;">Conclusion</span></span></strong><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></li>
</ul>
<p>&nbsp;</p>
<p class="MsoNormal"><a name="overview"></a><span style="mso-bookmark: overview;"></span><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />For a summary of general activities that are available and a brief description of each, you can refer to sites such as:<br /><br /><a href="https://blogs.msdn.com/b/endpoint/archive/2009/05/29/a-tour-on-the-wf4-activity-palette.aspx"><span style="color: #003366; text-decoration: none; text-underline: none;">https://blogs.msdn.com/b/endpoint/archive/2009/05/29/a-tour-on-the-wf4-activity-palette.aspx</span></a></span><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">In general, getting used to using the workflow approach can be a little unusual and confusing at first, but after playing around with it for a little while, you will find that some previously difficult tasks are made simpler with the workflow approach. Unfortunately, each time you open a new XAML file it reloads the toolbox activities which takes a while before it will show the complete workflow. You can view other available activities by right-clicking on the toolbox and clicking "Choose Items...". Clicking the .NET Framework Components tab will take a while to load the available components.</span><br /><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">When filling out expressions in the XAML editor, you will note that you need to use Visual Basic to form expressions. For example, for concatenation, you can use the ampersand character: '&amp;'. For multiple lines, use the underscore character '_'. You can also copy existing items within the XAML editor to other areas within the workflow by clicking where you want to copy the item to and then just paste. It preserves the data from the copied workflow item.</span><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a name="default"></a><span style="mso-bookmark: default;"></span><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />When first using workflow in Visual Studio 2010 team build, you may be wondering whether or not you should use the default template or the upgrade template. </span><br /><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><strong><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"></span></strong></p>
<p class="MsoNormal"><strong><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Upgrade Template</span></strong><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />If you are migrating a large amount of msbuild code from a TFS 2008 server, then it would probably be a lot easier to just use the upgrade template. The upgrade template will wrap a very simple workflow around a simple msbuild workflow activity which only does one thing: run TFSBuild.proj. When it runs TFSBuild.proj it will pass in all the typical parameters that msbuild will need to use the previous approach for building TFSBuild.proj. The advantage to this approach is that it's fairly simple and straightforward and you can still add as many other activities as you see fit. One disadvantage to this is that you lose some of the flexibility of using workflow activities in between specific team build events previously performed in TFS 2008. For example, if you wanted to perform some special logic before or after compiling individual solutions, you wouldn't be able to use workflow activities to assist with this. All your logic has to be before or after TFSBuild.proj is done. This includes workspace manipulation, build number changes, inserting in-between buildsteps, etc. All solution or project information will still be contained within the SolutionToBuild.proj file(s) as before.</span><br /><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes;"><v:shapetype o:spt="75" o:preferrelative="t" coordsize="21600,21600" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f" id="_x0000_t75"><v:stroke joinstyle="miter"></v:stroke><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"></v:f><v:f eqn="sum @0 1 0"></v:f><v:f eqn="sum 0 0 @1"></v:f><v:f eqn="prod @2 1 2"></v:f><v:f eqn="prod @3 21600 pixelWidth"></v:f><v:f eqn="prod @3 21600 pixelHeight"></v:f><v:f eqn="sum @0 0 1"></v:f><v:f eqn="prod @6 1 2"></v:f><v:f eqn="prod @7 21600 pixelWidth"></v:f><v:f eqn="sum @8 21600 0"></v:f><v:f eqn="prod @7 21600 pixelHeight"></v:f><v:f eqn="sum @10 21600 0"></v:f></v:formulas><v:path o:extrusionok="f" o:connecttype="rect" gradientshapeok="t"></v:path><o:lock v:ext="edit" aspectratio="t"></o:lock></v:shapetype></span><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><strong><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"></span></strong></p>
<p class="MsoNormal"><strong><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"></span></strong></p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/4544.UpgradeTemplateProcess.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/4544.UpgradeTemplateProcess.jpg" border="0" />&nbsp;</p>
<p class="MsoNormal"><strong><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Default Template</span></strong><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">If you are starting from scratch, it may be worthwhile to consider development using the DefaultTemplate. You will notice that the template is much larger and more complex than the upgrade template. This is mainly because the logic that would normally be contained in:</span><br /><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">C:\Program Files (x86) \MSBuild \Microsoft\VisualStudio \TeamBuild \Microsoft.TeamFoundation.Build.targets</span><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />is now contained directly within the DefaultTemplate.xaml. Although this makes the workflow look complicated, it gives easier access to internal functionality that was previously more complicated to change. For example, whenever, you wanted to implement a team build process differently than the way it worked before, you would have to "override" those targets contained within the targets files above by listing the same target with the "overridden" logic inside your own TFSBuild.proj (or imported files).</span><br /><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Furthermore, when using the default template you can change the set of projects or solutions that are built at the build definition level instead of having to check-in solution or project changes into the SolutionToBuild.proj file. This can be nice if you want to build different sets of projects within different build definitions.</span><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a name="template"></a><span style="mso-bookmark: template;"></span><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a name="multiple"></a><span style="mso-bookmark: multiple;"></span><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">One really cool feature in TFS 2010 Team Build is the ability to have multiple build definitions pointing to the same template. You don't have to use the DefaultTemplate or the UpgradeTemplate if you don't want to. In fact, it's recommended that you make your own when you feel the need to customize one of the pre-existing templates. Once you have a template that is flexible enough to work differently based on the parameters that are passed in, then you just change the process tab for the different build definition to point to the same template, but passing different parameters.</span><br /><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><a name="adding"></a><span style="mso-bookmark: adding;"></span><strong><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></strong></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">When you open a new build definition in team explorer and click on the process tab, you will notice a bunch of different parameters that you can tweak for a build definition. These fields are defined within the template XAML.</span><span style="font-family: 'Times New Roman','serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">When you open up a XAML template file, you will notice three tabs at the bottom of the visual workflow: Variables, Arguments, and Imports. In the <strong>Arguments </strong>tab, you can specify the input parameters passed into the template for processing from the build definition. As visible on the screen for creating the arguments, you can also specify the types and the default values for this.</span><br /><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/5165.Arguments.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/5165.Arguments.jpg" border="0" />&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes;"></span><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />You can refer to these parameters throughout your workflow template XAML just by starting to type the name of the parameter within a field that you're using later on in your workflow. Intellisense will pick up parameters.</span><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a name="workflow"></a><span style="mso-bookmark: workflow;"></span><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a name="executing"></a><span style="mso-bookmark: executing;"></span><strong><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></strong></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">One of the most basic abilities that is nice to perform is the ability to execute some shell based command. For instance, in msbuild scripts you could use the Exec custom task to execute some command (i.e. run some custom executable). One annoyance with the Exec command is the inability to capture and process the command output directly. Basically, you had to pipe the output to some text file and then read the text file and retrieve the information desired.</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Happily, WF4 makes this so much nicer by introducing the InvokeProcess activity. The activity lets you execute any provided executable through the "FileName" field and then pass the executable any arguments you want it to handle (such as a shell command).</span><br /><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;<img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/0363.InvokeProcess.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/0363.InvokeProcess.jpg" border="0" /></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes;"></span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />The beauty of using InvokeProcess is that you can immediately capture and/or perform some sort of activity-based logic on the output whether it's from the standard output or error output streams.</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a name="display"></a><strong><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></strong></p>
<p class="MsoNormal"><strong><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p>&nbsp;</o:p></span></strong></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">When you want to display something in Build Explorer when building, you can still display items using the BuildStep custom task when using the default template and calling the build steps inside of msbuild scripts. </span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">When trying to display information in Build Explorer outside of the context of msbuild, you can use workflow activities to display information about the build that is running. There are three simple activities that can help with this:</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<ul type="disc" style="margin-top: 0in;">
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: black; vertical-align: top; tab-stops: list .5in; mso-list: l1 level1 lfo2;"><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">WriteBuildMessage</span><span style="font-family: 'Verdana','sans-serif'; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: black; vertical-align: top; tab-stops: list .5in; mso-list: l1 level1 lfo2;"><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">WriteBuildWarning</span><span style="font-family: 'Verdana','sans-serif'; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"> <o:p></o:p></span></li>
<li class="MsoNormal" style="line-height: normal; margin: 0in 0in 10pt; color: black; vertical-align: top; tab-stops: list .5in; mso-list: l1 level1 lfo2;"><span style="font-family: 'Verdana','sans-serif'; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">WriteBuildError</span><span style="font-family: 'Verdana','sans-serif'; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></li>
</ul>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">WriteBuildMessage will show plain messages in BuildExplorer. It's displayed as pure text unlike the normal BuildSteps you might be accustomed to, which show the green circle. The problem with WriteBuildMessage is that it won't show your messages if you have minimal verbosity set. You have to set the verbosity to normal or higher to see these messages. You will also have to set the importance property for this activity to "high".</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />WriteBuildWarning will show the yellow triangle/exclamation mark and also won't show with minimal debugging. Once you change this to normal debugging, you will be able to see all the warnings (both custom generated and the warnings generated by the build).</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />WriteBuildError will show the red circle showing that an error was revealed. These custom generated errors don't stop the build, but they will cause the final status will not show success.</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />The main problem is if you have a huge amount of warnings and want to eliminate warnings, but also want to see the build messages. You either get your regular build messages and warnings, or you get neither. Fortunately, when you use most activities, they will still show messages with the title or description of the activity you are displaying.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a name="variables"></a><span style="mso-bookmark: variables;"></span><strong><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></strong></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">In TFS 2008 Team Build, the scope of properties were very tricky. Most of the time values had to continually be passed around or group in DependsOn blocks to maintain values across targets, but in TFS 2010 Team Build it's a lot easier.</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Once you have a template XAML open you can click the Variables tab and create any property with any .NET type by typing the name of the new variable and clicking the drop-menu for the type and selecting "Browse For Type...". You can then search every .NET namespace for the type you're looking for and then click it.</span><br /><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Once you have your variable setup, you can determine the scope. For example, variables created with the "Sequence" scope are accessible in the entire sequence (which is the main activity of the workflow). If you have different activities running on different build machines you can choose the "Run On Agent" scope which is specific to a build machine/agent.</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />You can give the variable a default value and also assign variables at any step along the way by using the "Assign" activity under the Primitives section in the toolbox.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><a name="conditioning"></a><span style="mso-bookmark: conditioning;"></span><strong><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></strong></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">The full span of .NET conditioning is available in WF4. You have access to switches, if/then and the other typical .NET based branching concepts. </span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">There are also the expected try, catch, exception activities as well. For example, if you throw an exception, it will display the exception and halt the workflow.</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />There are a couple activities that may seem a little unusual that also help in performing different handling techniques such as handling cancellations or performing recovery if something breaks later on in the workflow. </span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">For example, the CancellationScope activity is a container activity where if you can embed an activity inside the CancellationScope activity. You also provide a CancellationHandler activity. This means that if the workflow is cancelled while running the imbedded activity, then it will call the activity given inside the CancellationHandler portion. This allows for custom recovery of a cancellation.</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Another somewhat more advanced, but confusing activity is the CompensableActivity, which will run a given "Body" activity. Based on various circumstances, different handlers will be called. For example, if the activity is cancelled, it will call the activity provided as the CancellationHandler. If the workflow breaks anywhere after the entire CompensableActivity is finished executing successfully, then it will call the activity provided as the CompensationHandler. Otherwise, if the entire workflow completes successfully, then it will call the ConfirmationHandler. A common example for this, is if the "Body" is scheduling a flight. If the flight is cancelled while scheduling the flight, then you just cancel scheduling the flight. If after scheduling the flight successfully, you schedule a hotel and do some other random scheduling. If the flight is successfully scheduled, but let's say the hotel scheduling failed, then you would want to also provide some way to cancel the flight as well since you won't be able to go on the trip anyways.</span><br /><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes;"></span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/6811.Compensate.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/6811.Compensate.jpg" border="0" /></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a name="looping"></a><span style="mso-bookmark: looping;"></span><strong><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></strong></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">You can use most of the normal .NET looping structures such as ForEach, While, and DoWhile although there isn't an activity provided for a typical "for" loop. </span><br /><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">While and DoWhile are fairly simple by simply providing the body activity and the condition for continuing to execute the body activity over and over, the only difference, of course, is that DoWhile will execute once regardless of the condition.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">The ForEach&lt;Type&gt; is generic so you have to configure the properties for the activity to indicate the type of the individual item you will be pulling out of the collection. The first field is to represent the name of the individual item. Inside the expression you just give the name of the collection variable. When you setup the body activity, the item name is within the scope of the body of the foreach activity and can be accessed accordingly.<o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-no-proof: yes;"></span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/8715.ForEach.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/8715.ForEach.jpg" border="0" /></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a name="sequence"></a><span style="mso-bookmark: sequence;"></span><strong><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></strong></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">The sequence activity is known as a composite activity, because it allows other activities to be placed within it. If you ever need to cluster a set of activities inside a "single" activity, you simple drop a sequence inside the "single" activity placeholder and then drop all necessary activities inside the sequence.</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Please note that unlike flowcharts, you cannot go back earlier in a list of activities if you have already traversed the list.</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a name="flowchart"></a></p>
<p class="MsoNormal"><span style="mso-bookmark: flowchart;"><strong><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"></span></strong></span></p>
<p class="MsoNormal"><span style="mso-bookmark: flowchart;"><strong><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 10pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Flowchart</span></strong></span><span style="mso-bookmark: flowchart;"></span><strong><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></strong></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Flowcharts are workflow's way of allowing designers to go back and repeat previous steps already executed and navigate more freely directionally.</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><strong><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 8.5pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes;"></span></strong><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/7848.Flowchart.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/7848.Flowchart.jpg" border="0" />&nbsp;</o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />Here are the results:<o:p></o:p></span></p>
<p>&nbsp;<img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/2330.FlowchartResults.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/2330.FlowchartResults.jpg" border="0" /></p>
<p class="MsoNormal"><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-no-proof: yes;"></span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />It is important to note that you may have to include some additional assembly references so the Flowchart activity can operate correctly (necessary in RTM). If you're seeing the following error:</span><br /><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: #c00000; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">TF215097: An error occurred while initializing a build for build definition [Build Definition] Cannot create unknown type '{https://schemas.microsoft.com/winfx/2006/xaml/presentation}PointCollection'.</span><br /><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p>&nbsp;</p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Try adding the following import lines at the top of your .xaml file:</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">xmlns:swm="clr-namespace:System.Windows.Media;assembly=WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">xmlns:swm1="clr-namespace:System.Windows.Media;assembly=PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" </span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />Also, if you have graphical display issues where the flowchart halts display, try letting Windows (i.e. 7) adjust for best appearance or "Let Windows Choose What's Best For My Computer" in the Advanced System Settings "Visual Effects" section.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><a name="parallel"></a><span style="mso-bookmark: parallel;"></span><strong><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></strong></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">The parallel activity is unique because the activities placed within it can be placed next to another, which allows the flexibility to run multiple tasks at the same time.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><br />One interesting application of this is running tasks on multiple build agents. For example, you can put multiple AgentScope activities next to each other which allows the ability to spawn off different activities on various build machines to speed up build performance.</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-no-proof: yes;"></span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><strong><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></strong></p>
<p class="MsoNormal"><strong><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"><o:p></o:p></span></strong></p>
<p class="MsoNormal"><span style="mso-bookmark: imports;"><strong><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"></span></strong></span><span style="mso-bookmark: imports;"><strong><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"></span></strong></span></p>
<p class="MsoNormal"><span style="mso-bookmark: imports;"><strong><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"></span></strong></span></p>
<p><span style="mso-bookmark: imports;"></span><span style="mso-bookmark: imports;"><strong><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/44/32/8787.Parallel.jpg" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-44-32/8787.Parallel.jpg" border="0" /></strong></span></p>
<p class="MsoNormal"><br /><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Imports</span></p>
<p class="MsoNormal"><span style="mso-bookmark: imports;"><strong><span style="font-family: 'Verdana','sans-serif'; color: #003366; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';"></span></strong></span><span style="mso-bookmark: imports;"></span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">In TFS 2008 you couldn't easily use msbuild imports because the TFSBuild.proj file would try and import the files before performing the get to pull down files from source control. This sort of scenario isn't a problem in TFS 2010, because you can use activities such as the DownloadFiles activity to run prior to running the MSBuild activity so that these files are available locally before running older logic on the TFSBuild.proj. Of course, this applies only if you're using the UpgradeTemplate.xaml. If you're using the DefaultTemplate, you have more flexibility.</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><a name="conclusion"></a><span style="mso-bookmark: conclusion;"></span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family: 'Verdana','sans-serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman';">Windows Workflow Foundation (WF4) is a nice integration of all previous build capabilities available in MSBuild 3.5 TFS 2008 Team Build, while adding many useful flow control features that were more difficult if not nearly impossible in TFS 2008.</span><span style="font-family: 'Times New Roman','serif'; color: black; font-size: 12pt; mso-fareast-font-family: 'Times New Roman';"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p><span style="font-family: Calibri; font-size: small;">&nbsp;</span></o:p></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
  </channel>
</rss>