Archive

Archive for February, 2011

Team Build: Team Build Failed with “There was no endpoint listening at … ” Message


Yesterday I received the following error when I ran a manual team build

“There was no endpoint listening at … that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.”

I found out that the agents services were stopped. Started them and everything is back to normal. What stopped them? Not sure yet ūüėČ

You can check the team build agents by going to programs–>Microsoft Team Foundation Server 2010–>Team Foundation Server Administration console, click on build configuration

Categories: Team Build, TFS, TFS2010 Tags: , ,

Build Biztalk Deployment Framework Projects using TFS2010


The Biztalk Deployment Framework (BTDF) is a utility to help Biztalk administrators to easily output the Biztalk application, its components, configuration, and port bindings to an MSI package. Building Biztalk and BTDF projects can be automated using TFS Team Build because those projects are built using MSBuild. In TFS 2010, Microsoft changed the team build template from MSBuild configuration file to Workflow (WF4) activity. I have seen many posts asking how to use TFS Team Build to build BTDF projects but yet no one blogged about it. In this post, I will be modifying the default TFS2010 Team Build Template to support building BTDF msi packages.

Creating new Team Build Definition

  • Right click on one of the Teambuild definitions
  • Click New Build Definition

  • Enter the name of the build definition

  • Fill the Trigger, workspace and build default sections
  • Click on Process on the left
  • Click on Show Details
  • Click the New button
  • Click browse next to “Select the file to copy”
  • Select the Default Template, you can select the template you want to modify

  • Give it a name; I am naming it BTDFBuildProcessTemplate
  • Click Ok
  • In the Required group, click the ellipsis next to Items to Build
  • Add the solution you need to build which contains your Biztalk project(s)
  • Add the BTDF project you need to build, make sure that you switch the Items of type to *.*proj

  • Make sure that the solution is built first then the BTDFProj
  • Click the Configurations tab
  • My solution contains X86 and Any CPU projects, therefore I am choosing “Mixed Platforms”

  • Click OK
  • For this post, I am not running unit tests. Thus, I cleared the Automated Tests property
  • Change the MSBuild Platform to X86, otherwise Biztalk projects will fail

  • Save the build definition
  • Close the Team Build Definition.
  • Open Source Control from Team Explorer
  • Browse to the BuildProcessTemplates folder
  • Get latest version of the template we just created

Changes to the Default Template to Build Deployment Framework Projects

In this section, we will be modifying the workflow template we created in the previous section. Team build is different than building the solution from the visual studio. Team build creates two folders: one for the source files and one for the output called binaries. .btdfproj references biztalk dlls using a relative path which will be invalid when building the btdfproj using team build. We have two options, either to maintain the project structure and output the binaries to the source folder or add a condition to the .btdfproj to get the file from a different location when using Team Build. In this post, I will output the files into the bin folder in the source folder. This approach will affect your unit tests if you are running unit tests as team build checks the dlls in the binaries folder. It also affects copying the binaries to the drop folder. Another modification needs to be done to get this working. I will write another post to do such adjustment. The following steps adds activities to build the solutions and BTDF projects. The binaries of the projects will be output into the bin folder of each project in the source folder

  • Open the BTDFBuildProcessTemplate.xaml workflow xaml file created in the previous section
  • Click Collapse All

  • Expand On Agent

  • Expand the follow activities:
    • Try Compile, Test, and Associate Changesets and Work Items
    • Sequence
    • Compile, Test, and Associate Changesets and Work Items
    • Try Compile and Test
    • Compile and Test
    • For Each Configuration in BuildSettings.PlatformConfigurations
    • Compile and Test for Configuration
    • If BuildSettings.HasProjectsToBuild
    • For Each Project in BuildSettings.ProjectsToBuild
    • Try to Compile the Project
    • Compile the Project
  • Add a condition to check the type of the project to build by added an If activity between “Convert Server patch to Local” and “Run MSBuild for Project”

  • Drag and drop the “Run MSBuild for Project” to the Else section

  • In the If condition, check if the project extension is .btdfproj by entering the following condition:

IO.Path.GetExtension(localProject).Equals(“.btdfproj”)

  • Change the OutDir property to “” to output the binaries into the bin folder in the source directory. Thanks to Ajith ¬†
  • Change the Display name of the if activity to something meaningful

  • If the project is a biztalk deployment framework project (*.btdfproj),
    • Add a new MSBuild activity to the If body, and rename it to Build BTDF Msi’s

  • ¬†
    • Run msbuild (Build BTDF Msi’s activity) with the following arguments; we have set OutDir to “” to output the binaries into the source folder directory instead of the binaries folder.

  • Save the workflow and close it
  • Go to Source Control √†BuildProcessTemplates
  • Checkin the workflow that was modified

  • Queue a new build
  • After the build is done, you will find the projects’ executables and BTDF msi in the bin folder of each project

Change the Username of the Teambuild to Domain User


Following these steps to change the Teambuild account service username from NT AUTHORITY\ NETWORK SERVICE to a specific username (e.g. domain\username):

Change the TFS Build Service username to the new username

  • Open TFS Administration Console
  • Click Build Configuration

  • Click Stop, to stop the service
  • Click Properties
  • Choose “This account” in Credentials groupbox
  • Enter username and password

  • Click Start to start the service

Change Build Agents Username Account

  • Repeat the steps from the previous section on the build machine
  • Make sure that the username is in the Team Build Service Accounts group
    • Click Team menu √†Team Project Settings √†Group Membership

  • ¬†
    • Check Show global groups
    • Select Project Collection Build Service Accounts
    • Click the Properties button

  • ¬†
    • Make sure that the new username is there

Team Build: Could not find file ‘Microsoft.BizTalk.TOM.resources’ when running Biztalk Unit tests

February 15, 2011 1 comment

I have set up Team Build to build a solution that contains Biztalk and C# projects. The environment I used was Biztalk 2010 and TFS 2010. When running the unit tests related to Biztalk Schemas or Pipelines I used to receive the following exception:

Could not find file ‘Microsoft.BizTalk.TOM.resources’

I know that I have a reference to the Microsoft.BizTalk.TOM.dll assembly in the Biztalk project and the unit test project. Unit tests were running on Visual studio 2010 but failing on team build.

I figure out that for some reason, Team Build decides not to copy the Microsoft.BizTalk.TOM.dll assembly to the binaries folder of that unit test project although I have the “copy local” property set to true. To force deploying the assembly to the unit test folder, make sure that you add it to the testsetting¬†deploy option.¬†Make sure that Biztalk server is installed on the Teambuild¬†machine and the path for the assembly is valid on the Teambuild¬†server. Otherwise you need to checkin the assembly into source control and reference the assembly in source control.¬†

  1. Open the testsettings file used for the team build definition
  2. Click Deployment from the list on the left
  3. Click Add Files

 

How to Find Build Service Account in TFS2010 and Visual Studio 2010


  • Open Visual Studio
  • Open Team Explorer
  • Right click on team project
  • Select Team Project Settings menu item
  • Select Group Membership menu item

  • On the Project Groups on [Team Project Name] dialog, check Show global groups
  • Click Defaultcollection\Project Collection Build Service Account
  • The User or Group list box, lists the build Service Accounts

Setup the Permissions of Team Build’s Drop folder


The following post assumes the controllers are deployed on the TFS server and the agents are on the build server as shown in the following picture

It also assumes that the drop folder is on the build machine and is located at C:\Builds\Public Drop Folder\. As a best practice, public drop folders should be on file share server. To learn more about drop folder visit http://msdn.microsoft.com/en-us/library/bb778394.aspx

  • Login to the server where the drop folder will be created
  • Navigate to directory where the drop folder will be created (e.g. C:\Builds\)
  • Create a folder named “Public Drop Folder”
  • Right click on the folder
  • Click Properties

  • Click Advanced Sharing button
  • Check Share this folder
  • On the Advanced Sharing dialog, click Permissions button
  • On the Permissions for Public Drop Folder, click Add button
  • On the Select users, Computers, Service Accounts, or Groups, Click Object Type button
  • Make sure Computers object is Checked
  • Click OK

  • On the Select users, Computers, Service Accounts, or Groups, type the following in the Enter object names to select box TFSSERVERNAME$;Network Service Where TFSSERVERNAME$ (keep the $ character) is the build service account which was created on the TFS machine following Installing Build Controller on TFS Server and Agents on the Build Server. To find out what is the build service account read the How to Find Build Service Account topic. Network Service account is the network service account on the build machine

  • Click Check Names button
  • Click OK
  • On the Permissions for Public Drop Folder, give both user names Full Control access

  • Click OK
  • Click Ok to go back to the Public Drop Folder Properties dialog
  • Click the Security tab
  • Click Edit
  • Click Add
  • Make sure the Computer object type is checked
  • Enter the same accounts you entered when you setup the share (i.e. TFSSERVERNAME$;Network Service)
  • Give Full Control
  • Click OK
  • Click Close button to close the Public Drop folder Properties dialog

  • Now we are ready to create Team Builds
Categories: Team Build, TFS, TFS2010 Tags: , ,

Installing Build Controller on TFS Server and Agents on the Build Server


Configure Build Controllers

Permissions

To create or modify Build Agents, the user must be a member of Administrator group and the Manage build resources permission in Visual Studio Team Foundation Server must be set to Allow

Walkthrough

This section is a walkthrough for configuring TFS Build controller on the TFS Server and configuring TFS Agents on the Build server. The following figure illustrates what we are trying to achieve

  1. If TFS Build Service is not installed on the TFS Machine,
    1. follow steps 1-5 from Installing TFS Build Service (Controller and Agents on the same machine) walkthrough, to install TFS Build Service on the TFS machine
    2. Uncheck Launch Team Foundation Server Configuration Tool
    3. Click Finish
  2. Open Team Foundation Administration Console
  3. Select Build Configuration from the tree view on the right hand side
  4. Click Configure Installed Feature
  5. Click Start Wizard button
  6. Select you the TFS project by clicking on the Browse button
  7. On the Configure Team Foundation Build Service
    1. If you have configured the Build Service on another machine before now, Select Scale out build services radio button (option button) and Create New Build Controller. If you are configuring the controller for the first time you should see Use the default settings
    2. Select 0 (no build agents) from “Number of Agents to run on this machine” combo box dropdown. Remember we are only installing the Build Controller on the TFS machine while the Build Agents will be installed on the Build Machine.
  8. Select NT AUTHORITY\NETWORK SERVICE, then click Next
  9. Review the configuration, click Next
  10. Click Configure on the Readiness Check screen
  11. There should be no errors. Click Next to complete the wizard
  12. Build Configuration should look like the following figure

Configure Build Agents

Build Agents are resource intensive. You can distribute Build Agents across multiple workstations. The recommended practice is to have an agent per logical CPU core. For instance, if you have a dual core machine with hyper threading (HT) turned off, you should have two agents. If you have the dual core CPU with HT turn on, you should have four agents.

Permissions

To create or modify Build Agents, the user must be a member of Administrator group and the Manage build resources permission in Visual Studio Team Foundation Server must be set to Allow

Walkthrough

The following is a walkthrough for configuring Build Agents on the build server

  1. Login to the Build Server
  2. If Build Services is not installed on the build machine, follow steps 1-7 from Configure Build Controller
  3. On the Configure Team Foundation Build Service
    1. Select Scale out build services radio button
    2. User the recommended number of build agents
    3. Select the controller from your TFS machine in the Add this capacity to the following resource.
    4. Click Next
  4. Follow steps 9-12 from Configure Build Controllers
  5. Build Configuration should look like the following figure

Categories: TFS, TFS2010 Tags: , ,