<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>John W Powell : Automated Builds</title><link>http://blogs.msdn.com/johnwpowell/archive/tags/Automated+Builds/default.aspx</link><description>Tags: Automated Builds</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Automate SharePoint Solution Builds with Visual Studio Extensions For Windows SharePoint Services (VSEWSS) 1.3</title><link>http://blogs.msdn.com/johnwpowell/archive/2009/06/21/automate-sharepoint-solution-builds-with-visual-studio-extensions-for-windows-sharepoint-services-vsewss-1-3.aspx</link><pubDate>Sun, 21 Jun 2009 21:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9796334</guid><dc:creator>johnwpowell</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/johnwpowell/comments/9796334.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johnwpowell/commentrss.aspx?PostID=9796334</wfw:commentRss><description>&lt;P&gt;In this walkthrough, I’ll demonstrate how to achieve automated builds and continuous integration by creating a build script for VSEWSS 1.3 solutions.&amp;nbsp; The &lt;A href="http://spg.codeplex.com/" target=_blank mce_href="http://spg.codeplex.com/"&gt;patterns and practices SharePoint Guidance&lt;/A&gt;&amp;nbsp; (11 drop) contains an example build script that this article is based on, but I found some issues with it in practice that I’d like to share.&amp;nbsp; Before we get started, I’d like to talk about the design of the extensions and some of the problems you may encounter with them.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;VSEWSS 1.3 stores information used to build the wsp file in a directory named “pkg” that is &lt;EM&gt;not&lt;/EM&gt; included in the project.&amp;nbsp; This works fine for individual development on a single machine, but not so well for team development and build automation.&amp;nbsp; The pkg directory must be manually included in the project so files needed to build the wsp are included in source control.&amp;nbsp; If you forget to do this, your teammates won’t be able to build the wsp, and you risk losing deployment configuration.&amp;nbsp; Furthermore, if you later add a new feature, you also have manually add the new feature subdirectory to the project.&amp;nbsp; In addition to storing configuration information, the pkg directory is also where solution files (feature.xml for example) are automatically generated.&amp;nbsp; When you package the wsp (or refresh in the wsp view), the files in the pkg directory must be checked out to be re-generated.&amp;nbsp; This also causes problems on the build server because the files in the pkg directory are read-only because they are checked into source control.&amp;nbsp; An improved design would be to store wsp configuration information in a folder/file that is part of the project and use the pkg directory &lt;EM&gt;only&lt;/EM&gt; for generating packages based on the wsp configuration files.&amp;nbsp; So now that you are aware of some of the team development “gotchas” with VSEWSS 1.3, I’ll show you, step-by-step, how to configure automated builds.&lt;/P&gt;
&lt;P&gt;If you just want to see the build script, &lt;A href="http://cid-7cedcb8ed3a44629.skydrive.live.com/self.aspx/Public/TFSBuild.proj" target=_blank mce_href="http://cid-7cedcb8ed3a44629.skydrive.live.com/self.aspx/Public/TFSBuild.proj"&gt;get it here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Configure the build agent.&amp;nbsp; In the team project select &lt;EM&gt;Builds&lt;/EM&gt; &amp;gt; &lt;EM&gt;Manage Build Agents…&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image_2.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image_2.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="Manage Build Agents" border=0 alt="Manage Build Agents" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image_thumb.png" width=257 height=186 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Enter the build agent properties for your build server&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image3.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image3.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="Build Agent Properties" border=0 alt="Build Agent Properties" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image3_thumb.png" width=434 height=399 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image3_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Create a new build definition by selecting &lt;EM&gt;Builds&lt;/EM&gt; &amp;gt; &lt;EM&gt;New Build Definition…&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image6%5B1%5D.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image6%5B1%5D.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="New Build Definition" border=0 alt="New Build Definition" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image6%5B1%5D_thumb.png" width=240 height=180 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image6%5B1%5D_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Enter a name for the build definition&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image12.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image12.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="Build Definition General" border=0 alt="Build Definition General" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image12_thumb.png" width=600 height=400 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image12_thumb.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Configure the workspace.&amp;nbsp; Note: all files in the source control folder will be downloaded to the local folder you specify, so be sure the location you specify has enough free space&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image43.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image43.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="Build Definition Workspace" border=0 alt="Build Definition Workspace" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image43_thumb.png" width=600 height=400 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image43_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Create the project file (TFSBuild.proj) by selecting the version control folder where you want it stored and selecting &lt;EM&gt;Create…&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image18.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image18.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="Build Definition Project File" border=0 alt="Build Definition Project File" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image18_thumb.png" width=600 height=400 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image18_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Select the Visual Studio solution to build and click &lt;EM&gt;Next&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image21.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image21.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="MSBuild Project File Creation Wizard Selections" border=0 alt="MSBuild Project File Creation Wizard Selections" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image21_thumb.png" width=633 height=480 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image21_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Select the configuration(s) to build and click &lt;EM&gt;Next&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image24.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image24.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="MSBuild Project File Creation Wizard Configurations" border=0 alt="MSBuild Project File Creation Wizard Configurations" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image24_thumb.png" width=633 height=480 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image24_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;If you want to run unit tests or code analysis during the build, configure it and click &lt;EM&gt;Finish&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image27.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image27.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="MSBuild Project File Creation Wizard Options" border=0 alt="MSBuild Project File Creation Wizard Options" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image27_thumb.png" width=633 height=480 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image27_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Now that the project file is created, click &lt;EM&gt;OK&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image30.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image30.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="Build Definition Project File" border=0 alt="Build Definition Project File" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image30_thumb.png" width=600 height=400 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image30_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Configure how many builds you would like to retain and click &lt;EM&gt;OK&lt;/EM&gt;.&amp;nbsp; Note: you should at least keep the latest of failed or partially succeeded builds or the build log file you need to troubleshoot will be deleted&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image33.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image33.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="Build Definition Retention Policy" border=0 alt="Build Definition Retention Policy" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image33_thumb.png" width=600 height=400 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image33_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Enter a share where the build files will be dropped and click &lt;EM&gt;OK&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image36.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image36.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="Build Definition Defaults" border=0 alt="Build Definition Defaults" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image36_thumb.png" width=600 height=400 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image36_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Configure what triggers the build, either manually, on a schedule or when files are checked in (continuous integration)&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image39.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image39.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="Build Definition Trigger" border=0 alt="Build Definition Trigger" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image39_thumb.png" width=600 height=400 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image39_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Test the build by highlighting the build definition and selecting &lt;EM&gt;Queue New Build…&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image46.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image46.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="Queue New Build" border=0 alt="Queue New Build" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image46_thumb.png" width=258 height=210 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image46_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Click &lt;EM&gt;Queue&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image49.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image49.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="Queue Build" border=0 alt="Queue Build" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image49_thumb.png" width=370 height=431 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image49_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;At this point you should have a working build, but it doesn’t package the wsp file yet&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image52.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image52.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="Build Results" border=0 alt="Build Results" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image52_thumb.png" width=525 height=566 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image52_thumb.png"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Next, we’ll modify the build script to package the wsp file.&amp;nbsp; The build steps are as follows:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Clean up any workspaces / files left by the previous build packaging 
&lt;LI&gt;Build the Visual Studio solution 
&lt;LI&gt;Delete the workspace that was created by the build 
&lt;LI&gt;Create a workspace for the wsp packaging build 
&lt;LI&gt;Open a second instance of the IDE and package the solution using the /package switch 
&lt;LI&gt;Copy the wsp to the drop folder&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;In addition to this process, a nice to have is to display the packaging steps in the GUI, so we’ll use the BuildStep task to accomplish that&lt;/P&gt;
&lt;P&gt;To get started, get the latest version of the Team Build Types folder&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image1.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image1.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="Get Latest Version Team Build Types" border=0 alt="Get Latest Version Team Build Types" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image1_thumb.png" width=349 height=120 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image1_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Check out the TFSBuild.proj file.&amp;nbsp; Note: when developing the build script, you will have to check it out to work on it, and check it back in to test it&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image4.png" target=_blank mce_href="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image4.png"&gt;&lt;IMG style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="Check Out TFSBuild.proj" border=0 alt="Check Out TFSBuild.proj" src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image4_thumb.png" width=356 height=113 mce_src="http://blogs.msdn.com/blogfiles/johnwpowell/WindowsLiveWriter/ba178f93efba_BDC1/image4_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Add the custom tasks used by the build.&amp;nbsp; Although we could accomplish what we need to using TF commands, these tasks are installed with TFS and work well&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Project&lt;/SPAN&gt; &lt;SPAN class=attr&gt;DefaultTargets&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="DesktopBuild"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;xmlns&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://schemas.microsoft.com/developer/msbuild/2003"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;ToolsVersion&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="3.5"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;

  &lt;SPAN class=rem&gt;&amp;lt;!-- These tasks are used by the Team Build process defined in this file --&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;UsingTask&lt;/SPAN&gt; &lt;SPAN class=attr&gt;TaskName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Microsoft.TeamFoundation.Build.Tasks.DeleteWorkspaceTask"&lt;/SPAN&gt;
           &lt;SPAN class=attr&gt;AssemblyFile&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamBuildRefPath)\Microsoft.TeamFoundation.Build.Tasks.VersionControl.dll"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;UsingTask&lt;/SPAN&gt; &lt;SPAN class=attr&gt;TaskName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Microsoft.TeamFoundation.Build.Tasks.CreateWorkspaceTask"&lt;/SPAN&gt;
             &lt;SPAN class=attr&gt;AssemblyFile&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamBuildRefPath)\Microsoft.TeamFoundation.Build.Tasks.VersionControl.dll"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;Add the variables needed for wsp packaging.&amp;nbsp; Note: there is probably a better way to determine the location of the IDE&lt;/P&gt;&lt;PRE class=csharpcode&gt;  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;PropertyGroup&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=rem&gt;&amp;lt;!--  &lt;/SPAN&gt;
&lt;SPAN class=rem&gt;    Variables added for VSeWSS 1.3 builds &lt;/SPAN&gt;
&lt;SPAN class=rem&gt;    --&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=rem&gt;&amp;lt;!--  IDEPath&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;    The path in which DevEnv and TF reside &lt;/SPAN&gt;
&lt;SPAN class=rem&gt;    --&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;IDEPath&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;IDEPath&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=rem&gt;&amp;lt;!-- TempWorkspaceName&lt;/SPAN&gt;
&lt;SPAN class=rem&gt;    Workspace name, must not match an existing namespace name &lt;/SPAN&gt;
&lt;SPAN class=rem&gt;    --&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;TempWorkspaceName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;NightlyBuildTempWorkspace&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;TempWorkspaceName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
    
  &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;PropertyGroup&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;Add the solution to build.&amp;nbsp; Note: this will build the binaries, but will not generate the wsp file&lt;/P&gt;&lt;PRE class=csharpcode&gt;  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;ItemGroup&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;SolutionToBuild&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Include&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildProjectFolderPath)/../../Intranet/Intranet.sln"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Targets&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;Targets&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Properties&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;Properties&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;SolutionToBuild&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;

  &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;ItemGroup&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;Add the target to clean up any files left by the previous build packaging (if the previous build failed or was cancelled).&amp;nbsp; This target is called during the build just before the workspace is created to build the solution&lt;/P&gt;&lt;PRE class=csharpcode&gt;  &lt;SPAN class=rem&gt;&amp;lt;!-- Before the build workpace is initialized --&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Target&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="BeforeInitializeWorkspace"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=rem&gt;&amp;lt;!-- Delete temporary workspace (if left by previous build) --&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;Message&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Deleting temporary workspace &amp;amp;quot;$(TempWorkspaceName)&amp;amp;quot; (if left by previous build)."&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
      &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Output&lt;/SPAN&gt; &lt;SPAN class=attr&gt;TaskParameter&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Id"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;PropertyName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="StepId"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;DeleteWorkspaceTask&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TempWorkspaceName)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;DeleteLocalItems&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="true"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;DeleteWorkspaceTask&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TempWorkspaceName)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;DeleteLocalItems&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="false"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(StepId)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;Status&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Succeeded"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=rem&gt;&amp;lt;!-- Error Occurred --&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;OnError&lt;/SPAN&gt; &lt;SPAN class=attr&gt;ExecuteTargets&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="MarkBuildStepAsFailed"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;

  &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;Target&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;Add the error handling target.&amp;nbsp; If any of the other steps fail, they will call this target using ExecuteTargets&lt;/P&gt;&lt;PRE class=csharpcode&gt;    &lt;SPAN class=rem&gt;&amp;lt;!-- Handles custom errors --&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Target&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="MarkBuildStepAsFailed"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(StepId)"&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;Status&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Failed"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;Target&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;In the AfterCompile target, add the step to delete the workspace that was automatically created by the build&lt;/P&gt;&lt;PRE class=csharpcode&gt;&lt;SPAN class=rem&gt;&amp;lt;!-- After the solutions are compiled --&amp;gt;&lt;/SPAN&gt;
  &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Target&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="AfterCompile"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=rem&gt;&amp;lt;!-- Delete build workspace --&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;
            &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
            &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
            &lt;SPAN class=attr&gt;Message&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Deleting build workspace &amp;amp;quot;$(WorkspaceName)&amp;amp;quot;."&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
      &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Output&lt;/SPAN&gt; &lt;SPAN class=attr&gt;TaskParameter&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Id"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;PropertyName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="StepId"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;DeleteWorkspaceTask&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(WorkspaceName)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;DeleteLocalItems&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="false"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(StepId)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;Status&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Succeeded"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;&amp;lt;!-- END Delete build workspace --&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;Just below that, add the build step to create the temporary workspace&lt;/P&gt;&lt;PRE class=csharpcode&gt;    &lt;SPAN class=rem&gt;&amp;lt;!-- Create temporary workspace --&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;Message&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Creating temporary workspace &amp;amp;quot;$(TempWorkspaceName)&amp;amp;quot;."&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
      &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Output&lt;/SPAN&gt; &lt;SPAN class=attr&gt;TaskParameter&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Id"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;PropertyName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="StepId"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;CreateWorkspaceTask&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;BuildDirectory&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildDirectory)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;SourcesDirectory&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(SolutionRoot)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TempWorkspaceName)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;Comment&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Temporary workspace"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;CreateWorkspaceTask&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(StepId)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;Status&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Succeeded"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;&amp;lt;!-- END Create temporary workspace --&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;P&gt;Add the step to package the solution.&amp;nbsp; This first marks all files in the pkg directory as not read only--the packaging will not be able to overwrite these files otherwise.&amp;nbsp; Then it runs the IDE and uses the /package switch to generate the wsp.&amp;nbsp; Finally, it copies the wsp to the drop folder.&amp;nbsp; If you had multiple wsp files to build, you could repeat the steps below or refactor into a target&lt;/P&gt;&lt;PRE class=csharpcode&gt;    &lt;SPAN class=rem&gt;&amp;lt;!-- Place projects to package here --&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=rem&gt;&amp;lt;!--  Build and package solution --&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;Message&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Packaging &amp;amp;quot; Contoso Intranet solution&amp;amp;quot;."&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
      &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Output&lt;/SPAN&gt; &lt;SPAN class=attr&gt;TaskParameter&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Id"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;PropertyName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="StepId"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=rem&gt;&amp;lt;!-- The extensions modify files in the pkg directory, so those files cannot read only--&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Exec&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Command&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="attrib -R &amp;amp;quot;$(BuildDirectory)\Contoso\Intranet\Deployment\pkg\*.*&amp;amp;quot; /S /D"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=rem&gt;&amp;lt;!-- Open a second instance of the dev environment and build using /package switch  --&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Exec&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Command&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="&amp;amp;quot;$(IDEPath)\devenv&amp;amp;quot; &amp;amp;quot;$(BuildDirectory)\Contoso\Intranet\Intranet.sln&amp;amp;quot; /deploy debug /package"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=rem&gt;&amp;lt;!-- Copy to drop location --&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Exec&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Command&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="xcopy &amp;amp;quot;$(BuildDirectory)\Contoso\Intranet\Deployment\bin\debug\Contoso.Intranet.wsp&amp;amp;quot; &amp;amp;quot;$(DropLocation)\$(BuildNumber)\&amp;amp;quot; /E /Y /R"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(StepId)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;Status&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Succeeded"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;&amp;lt;!-- END Build and package solution --&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;Add the build step to delete the temporary workspace we created&lt;/P&gt;&lt;PRE class=csharpcode&gt;    &lt;SPAN class=rem&gt;&amp;lt;!-- Delete temporary workspace --&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
        &lt;SPAN class=attr&gt;Message&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Deleting temporary workspace &amp;amp;quot;$(TempWorkspaceName)&amp;amp;quot;."&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;
      &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Output&lt;/SPAN&gt; &lt;SPAN class=attr&gt;TaskParameter&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Id"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;PropertyName&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="StepId"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;

    
    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;DeleteWorkspaceTask&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TempWorkspaceName)"&lt;/SPAN&gt;
          &lt;SPAN class=attr&gt;DeleteLocalItems&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="false"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;

    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;BuildStep&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;TeamFoundationServerUrl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(TeamFoundationServerUrl)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;BuildUri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(BuildUri)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;Id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="$(StepId)"&lt;/SPAN&gt;
              &lt;SPAN class=attr&gt;Status&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Succeeded"&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=rem&gt;&amp;lt;!-- END Delete temporary workspace --&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	BACKGROUND-COLOR: #ffffff; FONT-FAMILY: consolas, "Courier New", courier, monospace; COLOR: black; FONT-SIZE: small
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; WIDTH: 100%
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;Check the project back in to source control, and queue the build to test it&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9796334" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johnwpowell/archive/tags/TFS/default.aspx">TFS</category><category domain="http://blogs.msdn.com/johnwpowell/archive/tags/WSS/default.aspx">WSS</category><category domain="http://blogs.msdn.com/johnwpowell/archive/tags/SharePoint+2007/default.aspx">SharePoint 2007</category><category domain="http://blogs.msdn.com/johnwpowell/archive/tags/msbuild/default.aspx">msbuild</category><category domain="http://blogs.msdn.com/johnwpowell/archive/tags/Automated+Builds/default.aspx">Automated Builds</category><category domain="http://blogs.msdn.com/johnwpowell/archive/tags/Continuous+Integration/default.aspx">Continuous Integration</category></item></channel></rss>