MSBuild in Visual Studio Part 11: Other Special Targets

The last two entries walked through how the Compile target is used by the IDE to drive certain features. There are a number of other targets that get called at various times.

Several targets exist to help compute project output groups, which are sets of files related to the project. These are useful when the IDE needs to know the answer to questions like “What are the output files for this build?” or “Where are your source files located?” These targets have pretty obvious names in Microsoft.Common.Targets, such as BuildProjectOutputGroup and SourceFilesProjectOutputGroup.

The easiest way to see one of these targets in action is to add a new Setup project to your solution and then add the “primary output” from your application to the Setup project. When that’s done you can right click on the primary output and select “Outpust”. This will call the appropriate target and display the results in a dialog:

Another group of targets are used to drive reference resolution, which is one of the most complicated parts of a build. Targets such as ResolveAssemblyReferences, ResolveComReferences, and ResolveNativeReferences are used to populate the copy local and path properties for the property grid.

The assembly reference targets are also used by the winforms designers so they can reflect on the correct types at design time.

That’s about all there is to talk about how MSBuild is used at design time by Visual Studio. Next time we’ll talk about how MSBuild is used to, well, build!

[ Author: Neil Enns ]