Applies to: Automated Build Studio 6
This tech-paper contains information on how to work with MSBuild projects in and organize your team builds with Automated Build Studio, SmartBear’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:
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, SmartBear 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.
We’ll start with visual editing of MSBuild projects since it makes working with MSBuild a lot easier.
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 a few task elements: Task, Microsoft Task, Automated Build Studio Task, TestComplete 6 Task and TestComplete 7 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 Automated Build Studio and TestComplete tasks are implemented by specific assemblies that are included into the Automated Build Studio and TestComplete installation packages, respectively. 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 6 Task (TestComplete 7 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.
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’s debugger also allows debugging script code included in macros (scripts are added to macros by using a special Script macro operation).
Automated Build Studio gives you the ability to execute parallel operations. The operations can be executed simultaneously in several threads and the macro debugger also works simultaneously with these threads:
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.
In fact, Visual Studio project files have the MSBuild project format. They just have specific extensions like .vcproj or .csproj. You can open these files for editing in Automated Build Studio (just change file extensions to .proj) 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++, etc.) and solutions of different versions of Visual Studio and many other compilers and development tools.
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).
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.
Automated Build Studio includes special operations that let you organize build actions within your macro into threads and execute them simultaneously. When a macro is executed on a multiprocessor computer, Automated Build Studio automatically selects the CPU to run each macro thread. For each new thread, the CPU with the least number of macro threads currently running is selected by Automated Build Studio. So, you benefit from the multiprocessor support since your automated builds are done faster.
Automated Build Studio includes several hundred operations that let you perform all automated build actions: getting source code files from a source control system, preparing sources for compilation, running the needed compiler, 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 to extend your team builds.
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.
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.
Yes, Automated Build Studio supports a lot of operations that let you automate your build process: from getting source code files from a source control system to uploading installation packages to a website. Using these operations and intuitive user interface, you can easily create macros that will perform the desired tasks (for instance, take source code files from a source control system, prepare them for compilation, build binary modules, create an installation package, run automated 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 includes a special assembly that lets Automated Build Studio 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 an Automated Build Studio task to your MSBuild project when editing it in Automated Build Studio. Just add the Automated Build Studio Task element to the needed place in your MSBuild project and specify the element’s properties to run the Automated Build Studio macro from the project:
That’s it! Now, your Automated Build Studio macro will be run as part of the MSBuild project.
We hope this information will help you extend your team builds and make your automated build process even more flexible and powerful!
© 2012 SmartBear Software. All rights reserved.