4

I've been looking for ages and I'm so exasperated because what I want to do is theoretically so simple!

I have a web project and when I tell my TFS to queue a new build I want my published files(or un-published files - I don't care) to end up in a static folder such as "C:\inetpub\myproj\webfiles".

I've checked out this post TFS 2010 Build Publish via file system which led me to this post Team Build: Publish locally using MSDeploy but I just don't get it and it doesn't seem to be working.

I have my build definition all set up and it builds successfully and will even build into a folder that I specifiy, but once it's built it ends up in a shed load of subfolders - one of which has a version number appended meaning IIS won't automatically pick up my latest version without some re-config. (I did remove the version bindings, but then it won't overwrite the last build with the latest build)

I'm currently messing around with these MSBuild Arguments to try and get it working:

/p:DeployOnBuild=true;
DeployTarget=PipelinePreDeployCopyAllFilesToOneFolder;
_PackageTempDir="\\HomeServer\inetpub\SiteTest";
AutoParameterizationWebConfigConnectionStrings=false

But there's a couple of points:

  • The 'SiteTest' folder is never created and
  • It's being accessed via share location when it's meant to be the HomeServer's local file system I want to publish too.

I just need to automatically get my web files inside of a folder I can predetermine for IIS, please help!

Community
  • 1
  • 1
Smithy
  • 2,170
  • 6
  • 29
  • 61

1 Answers1

1

I achieved this by customizing our build process template. Make a copy of your DefaultTemplate.xaml (DefaultTemplateV2.xaml for example) and open it.

If you're new to working in the workflow xaml editor I find it helps to collapse all first.

Once it's open, click on the root Sequence and click Arguments. Add three arguments:

  1. DeployBuild (Boolean) defaulted to False
  2. FromPath (String)
  3. InstallPath (String)

Then, in your workflow open these sections:

  • Run on Agent
  • Try Compile, Test and...
  • Under Try open the Sequence

At the bottom of the Sequence after Get Impacted Tests,.. open your toolbox and drag in an "If" workflow item. Set the Condition to DeployBuild.

In the Then section of the If drag in a CopyDirectory workflow item. Set the Destination to InstallPath and the Source to

String.Format("{0}\{1}", BinariesDirectory, FromPath).

Save it and check it in. You'll need to open a previous build and note the build subfolder you want to deploy. It'll be something like _PublishedWebsites\mywebsite\

Edit your build definition (you might have to close and reopen VS first) and go to the Process tab. Change the Build Process Template to your new version.

Set the FromPath to the path you just noted. Set the InstallPath to the UNC path of the destination folder (you'll need to make sure that whatever service account your builds run under has access to that path) and set DeployBuild to True.

Save, queue a build and test your deploy.

You can also, in your workflow XAML, go to Arguments and edit the Metadata argument with each of your new arguments. You can set where they can be viewed. So you could, for example, set the FromPath and InstallPath to only be viewed when editing the definition but DeployBuild to be seen when queuing a build. That way you could turn it on or off when queuing.

Good luck.

  • 1
    Thanks Paul, this is a much anticipated response - but we no longer have a build server >.< I'm going to mark your answer anyway as you seemed to have laid out the steps to customise the build output and put in a lot of research. Many thanks – Smithy Nov 27 '13 at 16:36