Extending ToolTask

There are many instances in which you need to invoke an .exe file in your build process. There is a task, the Exec task, which allows you to execute any command. This works great and is used throughout the MSBuild community. If you find yourself executing the same .exe on several occasions, then it may be worth writing a custom task to execute the command. Custom tasks that wrap up executables have many advantages to simply using the Exec task. Some of those benefits are outlined in the following list.

  • Ease of use. Since custom tasks have specific properties for inputs and outputs, they are very easy to use.

  • Better input validation. You can write .NET code to validate the parameters that the script is requesting be sent to the ...

Get Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.