1

Having asked question : https://stackoverflow.com/posts/comments/38046411?noredirect=1 I have decided perhaps I am looking at this problem the wrong way round.

The aim is to have a build definition which will when run redeploy the C# ASP.net application to the IIS service which is currently running.

I can manually update the files in the directory for the application but this is a manual process. I was looking at perhaps working out how to execute a batch script from a TFS 2012 Express Build Process xaml workflow file but then considered surely TFS build workflow xaml must have a build element for publish / package / deploy a ASP.net application to a IIS service / directory already and I simply need to know what it is called and how to do it?

Can anyone comment?

I am using Team Foundation Server Express 2012.

My TFS build process edit screen looks like this: tfs

Community
  • 1
  • 1
RenegadeAndy
  • 5,440
  • 18
  • 70
  • 130

2 Answers2

2

I do this by using an InvokeProcess activity to call a powershell script. The powershell script is stored in TFS, and will execute my WebDeploy package (that is built either earlier in the same build, or in a separate TFS Build).

In TFS 2013 the default template (TfvcTemplate.12.xaml) contains hooks to easily call powershell scripts at various points in the workflow, without having to modify the workflow (you just specify the path in the build definition). I realize you aren't using 2013, so you'll still have to edit the workflow. I just wanted to point out that this is considered a best practice, and MS has recognized that in TFS 2013 by making it even easier to do this.

Dylan Smith
  • 22,069
  • 2
  • 47
  • 62
  • How do you execute the web deploy package from the power shell script? Have you any idea how I can get to this similar point from 2012, because the default template doesn't offer the option of invokeprocess and I cannot find a guide on adding it manually. – RenegadeAndy Jul 03 '14 at 23:22
  • 2012 does include an InvokeProcess activity. And when you have your build publish a WebDeploy (using the MSBuild arguments: /p:DeployOnBuild=True /p:DeployTarget=Package) it will generate a WebDeploy package that includes a .cmd batch file that can deploy it. From powershell you simply call the .cmd file to execute the WebDeploy. – Dylan Smith Jul 04 '14 at 00:01
  • If you need info on customizing the build workflow see the Rangers guidance here: http://vsarbuildguide.codeplex.com/ – Dylan Smith Jul 04 '14 at 00:02
  • Please see what I see on my TFS build process in the picture above. - I dont see where to add the InvokeProcess activity...is there a specific window I need to open in VS? – RenegadeAndy Jul 04 '14 at 09:12
  • the screenshot is a build definition, a build definition is driven by a Process template. the process template is shown in the drop down list in your image. you need to open the process template from source control. You can then update the xaml / workflow with the Invoke process activity. – Just TFS Jul 04 '14 at 12:14
0

A Build in Team Foundation Server is based on an XAML workflow that contains all the steps that are taken when the build runs.

In your screenshot, you see at the top that you are using the Default Template (DefaultTemplate.11.1.xaml)

This file is located in a folder in souce control called Build Definitions. Editing this file and checking your changes in changes the build workflow.

The steps required to do this can be found here: Create and Work with a Custom Build Process Template.

Customizing your build process template is the recommended way of adding extra functionality to a build. As Dylan already pointed out, there is a lot of information in the community. The ALM Rangers have provided guidance but also a set of TFS build extensions that you can use out of the box.

Wouter de Kort
  • 39,090
  • 12
  • 84
  • 103
  • This is useful. I have checked out the BuildDefinitions but I cannot open and visualise them as it says cannot be visualised on x64 and ARM processors...I can however manually edit them if I knew the specific markup I would need! Any ideas what that would be? – RenegadeAndy Jul 04 '14 at 13:56
  • Not on x64 processors? That's strange.. I'm running 64 bit and I can edit the file. Which edition of Visual Studio are you using? – Wouter de Kort Jul 04 '14 at 13:58
  • I can edit it but not visually....I have visual studio express 2013 version 12.0.21005.1REL - now when I try to right click in the xaml file and say show view designer it just doesn't do anything...! – RenegadeAndy Jul 04 '14 at 14:13
  • I have added a new post for this problem : http://stackoverflow.com/questions/24578232/team-foundation-server-2012-express-buildtemplate-process-xaml-files-not-opening – RenegadeAndy Jul 04 '14 at 16:34