Customizing Drop Folder Structure with TFS Team Build

12,059

Solution 1

With a bit of customization, this solution ended up working for me:

http://www.edsquared.com/2011/01/31/Customizable+Output+Directories+For+TFS+2010+Build.aspx

Basically, did what that link recommended, but also leveraged a new solution configuration (which I called TeamBuild) rather than conditional property definitions.

I believe the key to making this all work was the passing of the outputDirectory as the TeamBuildOutDir argument to MSBuild. Embedding this variable reference in the OutDir or OutputPath variable was allowed Team Build to build to the correct staging location and then automatically copy files from that location to the drop folder.

I'm going to take this a little futher and get rid of the whole _PublishedWebSites thing, but that will be done entirely in the build workflow.

EDIT: TFS 2013 supports this natively with a simply build configuration option:

enter image description here

Solution 2

I think I can help with this, it looks like in the build targets that the published websites folder isn't created if the OutDir is the same as the OutputPath.

So this isn't perfect, but if you add the following into the csproj file in the first property group, you'll get everything deployed into "\bin\deploy\" including the _PublishedWebsites folder

<DeployOnBuild>True</DeployOnBuild>
<OutDir>bin\deploy\</OutDir>
Share:
12,059
RMD
Author by

RMD

Updated on June 04, 2022

Comments

  • RMD
    RMD almost 2 years

    I'm using TFS 2012 to automate a build of a solution which contains multiple windows services and two web applicaitons.

    I've used the guide I found here to customize the build process template so that the windows services are put in a folder structure that I like. Specifically:

    1. \dropserver\droproot\MyApp\BuildNumber\
      • \Service1
      • \Service2
      • \Service3
      • \Service4

    This works great, but unfortunately it doesn't work for web applicaitons. If I used the same strategy for those, I just get the contents of /bin for each web app, rather than the full site contents.

    MSBuild typically uses the web application targets to handle this, but for some reason, this doesn't work when you customize the build as I have. I no longer get the _PublishedWebSites folder in the build output. (I'm guessing that's because I cleared our the OutDir property of the MSBuild task.)

    Has anybody done something like this and gotten it to work with web applications as well?