InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

Custom MSBuild Tasks

Posted by Hartmut Wilms on Feb 21, 2008

Sections
Development
Topics
.NET ,
.NET Framework

Since version 2.0 Microsoft has integrated MSBuild, a build system, into the .NET Framework that is fully compatible with Visual Studio projects. Bart de Smet shows how to extend MSBuild via custom tasks.

Although the set of built-in MSBuild tasks covers most of a developer's needs, some areas - especially deployment, integration of version control systems, configuration of servers and IIS web sites as well as ActiveDirectory tasks are left out. The MSBuild Community Tasks Project and the SDC Tasks Library, which are both freely available, provide many MSBuild tasks that address most of the issues in these areas. If something's still missing, you have to (and can) help yourself.

Bart de Smet shows how to create and debug custom MSBuild tasks. Whereas his first article serves as an introduction to creating custom tasks, his second article is written in a cookbook-style and focuses on debugging. According to Bart the development of a custom task is divided into 8 steps:

Step 1 - Create a Class Library project

Step 2 - Import references

Step 3 - Implement the task skeleton

Step 4 - Task parameterization

Step 5 - Implementing functionality

Step 6 - Setting up debugging

Step 7 - Set a breakpoint and run

Step 8 - Advanced debugging

Debugging is essentially configured in the custom MSBuild task's project properties: The project's start action must be set to the MSBuild executable (which should match the MSBuild assemblies referenced by the project) and the start options have to include the path to a test MSBuild project file.

The MSBuild Team blog provides further information and help, and the article "MSBuild - What It Does and What You Can Expect in the Future" by Dan Moseley and Xin Yan is a good summary of MSBuild's features, concepts, new file format features in .NET 3.5, and future directions.

Unit Tests ??? by Pawel Stasiak Posted
MSBuild as xm script by Alvaro Gareppe Posted
  1. Back to top

    Unit Tests ???

    by Pawel Stasiak

    Seems that somebody forgot to add appropriate steps for unit tests preparation and execution...

  2. Back to top

    MSBuild as xm script

    by Alvaro Gareppe

    The MSBuild Custom Tags are very useful not only to especial deployment needs... are also useful to develop complex scripts where each step could be a custom task defined by the developer i.e. I have developed task to verify table data in automatic tests.

    You could use msbuilds and custom tags to develop specific scripts, where each action is develop by yourself, and the script flow is defined by the msbuild xml.

    Some information about msbuild for Spanish-speaking: allyoucaneatin30.blogspot.com/2008/02/msbuild-t...

Educational Content

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.

Interview: Software Systems Architecture: Working With Stakeholders Using Viewpoints and Perspectives

InfoQ spoke to the authors of Software Systems Architecture on a couple of new topics, the System Context viewpoint and Agile, which have been added to the second edition.