Understanding Tasks and Creating Targets

MSBuild has the concept of a task, which is simply a unit of work that can be executed during the build process. You can add both predefined and custom tasks to the build process inside the project file. (Most built-in tasks are self-explanatory, and if you use Visual Studio to create the project file, IntelliSense can be helpful as usual.) Tasks are specified within Target elements. A target is basically a container for tasks, and you can execute tasks by referring the enclosing Target element. For example, the following task sends a message to the specified output log (which is the Console window by default):

The important thing is assigning the Name property so that you can later refer to target. To ...

Get Visual Basic® 2010 Unleashed 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.