Build partially succeeded, but hey no (obvious) errors!

The other day I was trying out the new excellent “Test impact analysis” feature in Visual Studio – Team Foundation Server 2010 and I stumbled upon a rather mysterious problem as you can see from the screenshot below.

2010-12-04 10-46-21

The build says “Build partially succeeded” but as you can see I had NO build errors and ALL (one) my tests where passing!?!

So the first thing I did was to check the build log by clicking the link View Log as you can se below. 2010-12-04 10-32-13

By the way I really enjoy the new look and feel in Team Foundation Build, its precise, gives me a lot of valuable information and it gives me access to the most common command.
Anyway I browsed through the log and found this little piece of information hidden amongst all the other good stuff.

2010-12-04 10-40-14

Ok, I can see that I have some sort of Test Run Error so my first instinct was to run another build. But this time I was going to use another great new feature in Team Foundation Build i.e. the ability to set the type of logging verbosity needed for the build. I started a new build but this time I chose the Diagnostic level of logging instead of normal. Take a look at the picture below:

2010-12-04 10-38-28

Unfortunately the Diagnostic level didn’t help me much with the problem at hand and it took me a while before I found that my “Test Results” window was minimized and in that window was the solution to my whole mystery. As you can see when I opened  the “Test Results” window there is a warning and a link to the problem.

2010-12-04 10-41-48

Following that link gave me the precise clue to the problem:

2010-12-04 10-42-54

and the solution was easy to fix:

2010-12-04 10-43-44

So remember keep the “Test Results” opened at all times and you’ll avoid spending time chasing mysterious non existing errors.

Enjoy!

Hugo

Building and Unit Testing .Net 4.0 with Team Build 2008

One of the tasks this week was to install and configure a new BizTalk 2010 build server in my clients environment. Pretty straight forward you may say huh? Well it would be if my client was using TFS 2010 but in this case we’re talking about a TFS 2008.

There are lots of posts like this great post explaining how to do this and the building part worked fine. But I kept getting error telling me that unit tests where not able to run because I didn’t have the correct version of Visual Studio installed. Anyway here are the steps I followed to succeed with this endeavor:

  • Install BizTalk 2010 compilation components
  • Installed Team Build 2008
  • Installed Team Build Service Pack 1
  • Configured Team Build 2008 to use MSBuild 4.0 instead of MSBuild 3.5. To do this edit %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\TFSBuildService.exe.config and set the MSBuildPath property to C:\Windows\Microsoft.NET\Framework\v4.0.21006\
  • Restarted the Team Foundation Build service
  • Tried a simple Hello World application without unit tests and the build worked fine.
  • Added some unit tests to the Hello World application and got error the following error MSBUILD : warning : Visual Studio Team System for Software Testers or Visual Studio Team System for Software Developers is required to run tests as part of a Team Build
  • Installed Visual Studio 2010 Premium
  • Got new error telling me that there was some problem with workspace creation during build, found this solution.
  • Changed the property $(COMPUTERNAME)_$(BuildDefinitionId)_$(BuildAgentId) to $(COMPUTERNAME)_$(BuildDefinitionId) in the file %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\TFSBuildService.exe.config.
  • Got back the same old error MSBUILD : warning : Visual Studio Team System for Software Testers or Visual Studio Team System for Software Developers is required to run tests as part of a Team Build
  • Installed Visual Studio Team System 2008 Development Edition
  • Finally the build worked fine and all the unit tests ran successfully!

Hope this will summarize some of the issues you might run into when trying to build and unit test .Net 4.0 applications with Team Build 2008.

Cheers!

Hugo

End to end TFSBuild pattern for BizTalk 2009, part 2 (Tools)

Ok, you finally got your build environment installed and tested with a simple Hello World build and you’re ready for the next phase.

Before I show you the good stuff J there is some tools that you need to succeed with this quest:

  • You’ll need basic knowledge of MSBuild and TFSBuild or you could copy and paste my build pattern if you like J
  • I mainly use the OOB tools that come with .Net framework and BizTalk i.e. BTSTask, BTSWCFServicePublishing and GacUtil with my builds because I find them to be stable, supported and generally well documented.
    These tools should already be installed in your environment but you’ll have to make sure that you have the correct permissions on your TFSBuild service account to use them.
  • I use BizTalk MsBuild Generator to start and stop BizTalk applications so you will need to download the tool and extract BizTalk.BuildGenerator.Tasks.dll and BizTalk.BuildGenerator.tasks. These two files are then placed under source control with the teambuildtype.
  • If you need automatic generation of the BizTalk binding-files from a template (for different target environment for instance) I have found the XMLPreprocess tool very helpful.
  • In the early years I used the SDC tasks but it’s no longer supported but there is still a lot of good stuff in that package if you want to learn MSBuild in more depth. The replacement is called MSBuild Extension Pack if you want to check it out. While you’re at it you should really checkout MSBuild Explorer.

Try to install the tools in a common directory i.e. C:\BuildTools or something similar and keep these tools under source control at all time.

Until next time have a good one!

Hugo