AutomatedQA Corporation
Last updated: December 16, 2008
This tech-paper contains information on how to work with MSBuild projects in and
organize your team builds with Automated Build Studio, AutomatedQA’s build and release
management system.
MSBuild is a special platform for building applications developed with Microsoft
Visual Studio. To compile applications, MSBuild projects include special elements
that specify source files for the build and define the desired result (target).
MSBuild works as a command-line utility. It receives the project name as a command-line
argument. It also can accept other arguments that specify the build configuration.
Some time ago, Dan Moseley, from Microsoft, released a poll:
“How would you spend $100 on MSBuild?”.
Dan gave a list of dozen new features and asked the readers if they had only $100
to spend, how would they distribute it amongst these features. After getting 80
opinions, Dan processed the data and
published the results. In short, the readers supported the following:
- Debugging
- Converting other project types to MSBuild project
- Converting Visual Studio solutions to the format of MSBuild projects
- Visual editing of MSBuild projects
- Better support for VC++ projects
- Distributed builds
- Inline tasks
- Multiprocessor support
- Extensible functions
- Dependency checking
- Support for assembly versioning
- Typing\scoping
Most of these demands can be considered not only as requests for MSBuild enhancements,
but also as the demands for a build management system. After reading these results,
AutomatedQA was happy to see that our product, Automated Build Studio, already supported
many of the described features.
Let’s compare the Automated Build Studio functionality and see how it correlates
with the list of demands that appeared after Dan’s poll.
I’ll start with visual editing of MSBuild projects since it makes working with MSBuild
a lot easier.
Visual Editing of MSBuild Projects with Automated Build Studio
With Automated Build Studio, you can modify MSBuild projects visually. After you
open your project in Automated Build Studio, you see the project contents in the
main window. On the left, there is a list of available MSBuild elements:

You can add the desired elements to the MSBuild project by dragging them from the
Operations list to the project. After dragging an element, you can double-click
it and modify the element’s properties in Automated Build Studio’s dialogs. For
example, the following image shows the properties of a Csc task:

Automated Build Studio provides easy-to-use features for setting the task properties,
so you don’t have to specify items manually. You just choose them from the appropriate
dialog. It also allows you to enter them manually, if you prefer this method:

As you can see, this dialog displays the items and properties defined in your MSBuild
project as well as environment variables and reserved MSBuild properties (like
MSBUildBinPath or MSBuildProjectFile). There is no need
to remember their names, you just choose them in the dialog.
Unlike some freeware tools, Automated Build Studio supports all of the elements
that can be used in MSBuild projects. Also, it doesn’t add specific comments to
the project and doesn’t re-group elements during the project modification.
To simplify the task creation, Automated Build Studio offers four task elements:
Microsoft Task, Task, Automated Build Studio Task and TestComplete Task. All of
these elements are stored in the MSBuild project as tasks with the appropriate settings.
We use different elements just to simplify the task creation:
- The Microsoft Task element corresponds to typical tasks built into MSBuild
(AL, Csc, Copy and so on).
- The Task elements are used to execute tasks that you import into your MSBuild
projects with the Using Task elements.
- The Automated Build Studio Task is used to run Automated Build Studio macros
from MSBuild projects.
- The TestComplete Task is used to execute TestComplete tests during team
builds that you perform with MSBuild.
The last two tasks are implemented by specific assemblies that are included into
the Automated Build Studio and TestComplete installation packages. When you insert
these tasks into your MSBuild project, Automated Build Studio automatically appends
the Using Task elements that link the assemblies to the project.
By using the Automated Build Studio Task and TestComplete Task elements you can
easily extend your MSBuild projects with the functionality provided by Automated
Build Studio and TestComplete. This makes the build procedures more powerful and
flexible.
Now we can look at other user requests for MSBuild and check if they are supported
by Automated Build Studio.
Debugging
Though Automated Build Studio supports editing of MSBuild projects, it does not
support debugging them, because these projects are “foreign” relative to the macros
that are the “native” project type for Automated Build Studio. As for macros, Automated
Build Studio provides a powerful built-in debugger that supports many features of
modern program language debuggers like breakpoints (simple and conditional), Watch
panel, Evaluate dialog, Run to the Cursor, Trace Into and Run Over commands and
many more.
Automated Build Studio macros consist of operations that perform these actions.
The point is that Automated Build Studio gives you the ability to execute parallel
operations. The operations can be executed simultaneously in several threads and
the debugger also works with several threads:

Distributed Builds
Automated Build Studio supports
distributed builds. It means that the operations can be performed simultaneously
on different machines through the network. With Automated Build Studio you can organize
the parallel operation execution manually or use special features that will organize
the parallel execution automatically. Besides parallel executions on several computers,
Automated Build Studio also supports multithreaded execution of operations within
a macro on a single computer.
Converting Other Project Types and Solutions to MSBuild Projects
In fact, Visual Studio solutions and projects are MSBuild files. They just have
specific extensions like .csproj or .sln. You can open these files for editing in
Automated Build Studio and modify them the same way you modify other MSBuild projects.
If you create Automated Build Studio macros to build your applications, you can
use special operations that provide native and easy-to-use support for building
Visual Studio projects. Automated Build Studio includes a lot of operations that
support various project types (C#, VB, C++, J#, etc.) and solutions of different versions
of Visual Studio and
many other compilers and development tools.
Better Support for VC++ Projects
Automated Build Studio includes special operations that let you easily build VC++
applications from your macros. Furthermore, Automated Build Studio supports other
popular
modern compilers and development tools, so, you can easily use it to build
applications that contain modules created in different program languages (for example,
a DLL in VC++, an executable in C#, and so on).
Inline Tasks
This feature implies the creation of custom tasks like scripts performing specific
actions during the build process and this feature already exists in Automated Build
Studio. You can write VBScript, JScript or DelphiScript routines to perform those
specific tasks, for which you cannot find a built-in operation. You can also create
custom operations in C# or Delphi. Finally, you can create the libraries of operations
and use them in your macros in a way that is similar to using DLLs in executables.
Multiprocessor Support
Automated Build Studio includes special operations that let you organize build actions
within your macro into threads and execute them simultaneously. And if your operating
system is able to distribute threads among several CPUs, you benefit from the multi-processor
support since your builds are done faster.
Extensible Functions
Automated Build Studio includes several hundreds of operations that let you perform
all build actions: getting sources from source control, preparing sources for compilation,
running the compiling, setting version information for compiled modules, running
tests and much more. As previously stated, you can also write VBScript, JScript
or DelphiScript routines to perform specific actions, for which you cannot find
a ready-made operation, or you can create custom operations in C# or Delphi. Since
you can call Automated Build Studio macros from MSBuild projects, you can use all
of these operations for your team builds.
Dependency Checking
Automated Build Studio macros support two run concepts:
-
The operations that make up a macro, can run in their order in the macro.
-
The operations can be organized into groups, for which you specify dependencies.
Before running the macro, Automated Build Studio checks the dependencies and if
the check fails, the macro is not executed.
Support for Assembly Versioning
Automated Build Studio includes a special Edit Assembly Information operation
that lets you specify version information as well as other data included in an assembly.
So, specifying an assembly version is just a matter of entering text into an edit
box. By using macro variables you can store the version information between the
runs. All of these make the versioning support very easy to implement.
Now, let’s see what you can do to perform team builds with Automated Build Studio:
Can I Use Automated Build Studio to do Team Builds?
Yes. Automated Build Studio supports a lot of operations that let you automate any
step of your build process: from getting sources from a source control to uploading
installation packages to a web site. Using these operations and intuitive user interface,
you can easily create macros that will perform the desired tasks (for instance,
take sources from source control, prepare them for compilation, build binary modules,
create installation package, run tests, send notifications and so on).
But how do you call Automated Build Studio from Team Build? It’s easy! As previously
stated, the Automated Build Studio installation package has a special assembly that
lets Automated Build Studio’s macros be called from MSBuild projects (by the way,
the “reverse” action is also possible and MSBuild projects can be run from Automated
Build Studio macros).
So, to do team builds with Automated Build Studio, you need to:
-
Create Automated Build Studio macros for performing the necessary actions.
-
Install Automated Build Studio on the machine that you are planning to use for the
build process.
-
Add specific Automated Build Studio tasks to your MSBuild project (in order for
the macro to function as a part of the Team Build).
You can easily add the Automated Build Studio task when editing your MSBuild project
in Automated Build Studio: It also provides specific Task elements that let you
run Automated Build Studio macros from MSBuild projects:

That’s it! Now your Automated Build Studio macro will function as part of a MSBuild
project.
I hope this information will help you extend your team builds and make them more
flexible and powerful!