Setting up a standalone TFS with CI and automated deployment (Part 2)

In my previous post, we looked at setting up a standalone instance of TFS.  In this post, let’s look at setting automated builds in TFS.

 

Goal: Configure Build Service / Controller / Agents

  1. Open Team Foundation Server Administration Console.
  2. Navigate to the “Build Configuration” node, and stop your Build Service.
  3. Remove all controllers and agents if they were previously set up.
  4. Click Properties, then point the Build Controller to your Team Project Collection.
  5. Start the Build Service
  6. Click New Controller, and set up your build controller. Disable/Enable/Refresh for the build controller to come online.
  7. Click New Agent, and set up your build agent.
  8. Open Team Explorer and connect to your Project.
  9. Right click on “Builds”, then “Manage Build Controllers”.  The Build Controller and Agent(s) should be visible.image

Achievement: Your build controllers and agents are set up.

Goal: Set up Custom Build Qualities

  1. Open Team Explorer and connect to your Project.
  2. Right click on “Builds”, then “Manage Build Qualities”.
  3. Add/Remove the list of Quality Namesimage

Achievement: You have set up build qualities to reflect your deployment workflow.  These will later be used to track and even trigger automatic deployments.

 

Goal: Preparing for build and deployment

  1. Open solution, and select the select Web Application Project File.
  2. Right click on the web project, select properties.  Open the Package/Publish Web tab.
  3. Ensure that “Create deployment package as a zip file” is checked.
  4. Ensure that “IIS Web site/application name to use on the destination server” is set up to the value that you want.  This will save you a lot of pain later.image

Achievement: You have configured the target location of your deployment.  This will be preconfigured when you build the project into a package.

 

Goal: Create drop/symbol folders

  1. Create a directory where successful build are copied to.  This will also be the source location that your subsequent deployment go out from.  I made mine in C:\Build
  2. Share this folder, and ensure that the account that runs the build service has access to this share.  In my case, the service account is the SYSTEM account.
    image
  3. Create a directory where successful build are copied to. This will also be the source location that your subsequent deployment go out from. I made mine in C:\Symbols
  4. Share this folder, and ensure that the account that runs the build service has access to this share. In my case, the service account is the SYSTEM account.
    image

Achievement: You have configured the necessary shared folders for your builds.

 

Goal: Create a New Build Definition

  1. Open Team Explorer and connect to your Project.
  2. Right click on “Builds”, then “New Build Definition”.
  3. Under the Trigger tab, set it to manual.  You can change it later when everything is done.
  4. Under build defaults, set up the drop location.image
  5. Under Process, set up the project(s) and build configurations.  My settings happen to be as follows:
    – Configurations to build: Any CPU|Debug, Any CPU|Release
    – Clean Workspace: None
    – Path to Publish Symbols: \Symbols">\Symbols">\Symbols">\\<servername>\Symbols
    – MSBuild Arguments: /p:CreatePackageOnPublish=true /p:DeployOnBuild=true
    image
  6. Save your Build Definition.

Achievement: You have defined a build definition.

Goal: Check your Build Definition

  1. From the Team Explorer, right click on your new build definition, select “Queue New Build”, then “Queue”.
  2. Wait for the server to perform the build and hopefully you are rewarded with the Green OK icon!
  3. Check the location where your build agent performs the build, you should see a similar structure.
    image
  4. Check the drop location, you should see a similar structure.
    image
  5. Check the symbol folder, you should see a similar structure.
    image
  6. You can directly take the package and import it to your web server.
  7. You can also set the build quality of your builds directly from the screen.  We’ll soon look at how setting this quality can trigger a deployment to your target servers.
    image

Achievement: You have performed a build via TFS.  Now you can configure the triggers to suit your needs.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s