TFS Team Build 2010: How to place the build output to a fixed location

By default, TFS Team Build creates a new folder in the drop location for every build. I have seen request from people that wonder how to always have team build put the output in the same folder every time, effectively overwriting the results from the last build. This is easy to accomplish by adding an activity that copies the drop folder to a fixed location.

To copy the result of the build to a fixed location, you need to modify the build process template:

  1. Open the build process template XAML file in the workflow designer.
  2. Click on the Collapse All link in the upper right corner so that only the top level activities are shown
  3. Open the Toolbox window and locate the CopyDirectory activity (it is located in the Team Foundation Build Activities tab)
  4. Drag the CopyDirectory activity onto the design surface and drop it between the Run On Agent and the Check In Gated Changes for CheckInShelveset Builds activity:

    image  

  5. Right click on the CopyDirectory activity and select Properties. Fill out the properties, you will of course need to modify the path for the destination accordingly:

    image

  6. Save the build definition and check it in. NB: Remember to check in the build process template file after modifying it, a lot of times people forget this step!
  7. Queue a new build and, after the build has succeeded, verify that the build output has been copied to the corresponding output path

To make this build process template more generic, you proabably want to create a process parameter that lets you define the path either when you create a new build definition, or when you queue the build (or both). This will let you you reuse the build process template for builds with different output paths

0 thoughts on “TFS Team Build 2010: How to place the build output to a fixed location”

  1. Originally posted on: http://geekswithblogs.net/jakob/archive/2010/09/01/tfs-team-build-2010-how-to-place-the-build-output.aspx#619023

    Why can’t i set a normal physical path (e.g. D:WebSitesMyWebSite) for the build output? I have TFS and web sites on the same machine and i need to copy my build output files just to another directory on the same machine. But i can’t make it because i can set my drop directory only in the Visual Studio project properties that accepts only UNC paths…Do i need to use some custom publishing actions to copy my build output from default build folder to the www root of my IIS web sites?

  2. Originally posted on: http://geekswithblogs.net/jakob/archive/2010/09/01/tfs-team-build-2010-how-to-place-the-build-output.aspx#619033

    @Andrey: No, team build will create a new drop folder beneath the drop location on every build. This post describe how you can take the output from the drop folder and copy it to a fixed location, which basically is what you need.

    Another option for you, since you are developing web apps, is to use web deploy to publish your web application. If you are using VS2012, create a publish profile and check it in, then add this to the MSBuild Arguments parameter in your build definition:

    /p:DeployOnBuild=true;PublishProfile=”MyPublishProfileName”

    Hope that helps

  3. Originally posted on: http://geekswithblogs.net/jakob/archive/2010/09/01/tfs-team-build-2010-how-to-place-the-build-output.aspx#620341

    Jakob,
    I am trying to deloy WCF service of .net in TFS2012 using build defination and useed below args in msbuild in the arguments

    /p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:MSDeployPublishMethod=InProc /p:MSDeployServiceUrl=win-gs9gmujits8 /p:DeployIISAppPath=”Sites/Website name”

    but thi is not deplying the published folder on iis virtual shared directoy although there is no error reported . so i used your copydietcory approach to manually copy it to shared IIS virtual directory after build , but is there more smart way to do it rathet tahn creating new template for this for diffrent build ?

    also i dont want all files under _PublishedWebsites folder as thet are web.config and other xml files also which are created and i want to exlude them and coply only bin and servrice folder to IIS , so do i need as many diffrent copydirectot task in defination to give source as _PublishedWebsitesbin, _PublishedWebsitesXXXX and ,_PublishedWebsitesYYYY folder separtely or is there much easier and better way to achive this ?

    Any help is well appreciated .

  4. Originally posted on: http://geekswithblogs.net/jakob/archive/2010/09/01/tfs-team-build-2010-how-to-place-the-build-output.aspx#638567

    I am looking for the same and this post helped, Thanks.
    In addition to this, I am looking to create 4 sub-folders at the destination for my 8 projects in the solution. What is the recommended way to do this. Based on it, I have two question:
    1. Should I use CreateDirectory and CopyDirectory activities. OR use arguments in MSBuild.
    2. In the example source of Copy is the DropLocation. As per my understanding build server makes a copy of source and build files. So isn’t it a good idea to copy files directly from Build Server (something like $build folderbin) to \ServerPathSomeShare. Currently, I don’t know how to do this, but if kindly provide info if you know how to do it.

    Thanks
    Hardy

  5. Originally posted on: http://geekswithblogs.net/jakob/archive/2010/09/01/tfs-team-build-2010-how-to-place-the-build-output.aspx#638786

    Hi Everyone,

    I am trying an TFS autobuild continous integration. When a developer checks in the code, the build definition executes the code and Drops the publish files to a Location with build numbers incrementally. once the Code is checked in, i would like the build defination to delete the old publish files and deploy the new publish file to the same location of the drop location, Am doing this because my drop location is mapped to iis virtual directory, does any one have a better solution.

  6. Originally posted on: http://geekswithblogs.net/jakob/archive/2010/09/01/tfs-team-build-2010-how-to-place-the-build-output.aspx#644958

    Hi ,
    I am not able to copy the files to another server path (UAC).. Even that shared folder has full permission for everyone. I am getting some user name and password is incorrect error. Is there any option to provide credentials in CopyDirectory property.

    I tried to copy to another folder in the build server and it is working fine.

    please check the build log;

    Drop Files to Drop Location

    00:00
    CopyPublish
    Exception Message: The user name or password is incorrect.
    (type IOException)
    Exception Stack Trace: at Microsoft.TeamFoundation.Build.Workflow.Activities.WindowsDropProvider.EndCopyDirectory(IAsyncResult result)
    at Microsoft.TeamFoundation.Build.Workflow.Activities.CopyDirectory.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
    at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Leave a Reply

Your email address will not be published. Required fields are marked *