5

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?

RMD
  • 3,421
  • 7
  • 39
  • 85

5 Answers5

1

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>
Matt Whetton
  • 6,616
  • 5
  • 36
  • 57
  • Giving this a shot now... why do I need to specify this twice? – RMD Feb 18 '13 at 19:01
  • I added this to my proj file, but it doesn't appear to have made any difference. When I build the "TeamBuild" configuration in VS, I get the binary output copied to my target directory structure, but none of the rest of the web files (html, js, css, images, etc) are copied. – RMD Feb 18 '13 at 19:03
  • Sorry, I missed something further down, that wasn't actually the going to solve it. I've made an amend that I think will help - although its not perfect. – Matt Whetton Feb 18 '13 at 19:38
  • Just gave this a shot... still no dice. I'm still only getting the binary output in my drop location. Same deal when I build manually inside VS. – RMD Feb 19 '13 at 14:57
  • Can you try again with the True immediately before the bin\deploy\ - do you get the "deploy" folder within your bin folder? – Matt Whetton Feb 19 '13 at 15:00
  • We're making progress! My drop location now has a _PublishedWebsites folder, but that folder contains a deployment package rather than the project output. – RMD Feb 19 '13 at 21:07
  • Do you still have those settings from before in there (the 2 WebProjectOutputDir) ones - if so they probably need to be removed. If you build inside of visual studio, what is it putting in your bin folder? – Matt Whetton Feb 19 '13 at 22:34
  • Matt - no, I now only have DeployOnBuild, OutputPath, and OutDir specified. – RMD Feb 26 '13 at 18:36
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

RMD
  • 3,421
  • 7
  • 39
  • 85
  • I have used the EdSquared solution to great effect, also. I highly recommend it. There are some details in the comments that are important to note (i.e. OutDir property must end with a trailing slash, etc). – efisher Jan 06 '14 at 21:31
0

Take a look at this thread as this post as well. Team Build: Publish locally using MSDeploy Since you need all the files for your web projects, you need to trigger the publishing process, and by tweaking the destination of that process, you can have all of your files copied where you need them. I think option (2) from his answer will work for you. I hope that helps.

Community
  • 1
  • 1
Biser C.
  • 553
  • 5
  • 11
0

As I can see in your reference link, it will just compile and package the binaries. It does not deploy the website by the steps mentioned in that.

If you want to get the .html, .css, .js etc. under the _PublishedWebSites folder, you need to do a Web Deployment. This manually we can do by clicking the publish option from right click menu of your VS project and by selecting Publish Method as File System.

But, since you need to automate this in your build and drop it in custom drop folder, you may need to manipulate your MSBuild script by calling a AspNetCompiler task. You can get more information on this at the MSDN link. By specifying the TargetPath while you call this target you can get your Web files deployed at the appropriate custom drop folder.

Happy Scripting.

RinoTom
  • 2,278
  • 2
  • 26
  • 40
0

Have you check this blog, this solved my problem where I wanted customized TeamBuild Ouput Directory. Customizable O/P with TFS 2013

Customizaable O/P with TFS 2012 and .NET Framework 4.5

Varun
  • 743
  • 1
  • 5
  • 11