Hack the Build: Lay of the Land

Jomo Fisher--I think it would be helpful to take a step back and look at the files that are part of MSBuild.

 

The binaries are all installed in the framework folder (e.g. c:\Windows\Microsoft.NET\Framework\v2.0.xxxx):

 

MSBuild.exe – is the command-line driver. Any C# or VB project you create in VS can also be passed to MSBuild.exe to be built from the command-line.

 

Microsoft.Build.Engine.dll – is the common build engine that’s consumed by VS and MSBuild.exe. The engine is responsible for reading in and executing build scripts.

 

Microsoft.Build.Tasks.dll – contains MSBuild “tasks” which are discrete, reusable build components. For example, there’s a Copy task which can be used to copy files around. There’s also a Csc task for invoking the C# compiler.

 

Microsoft.Build.Utilities.dll – is a set of utilities classes useful for people who want to write their own tasks. There’s a convenient Task base class that has helpers for doing a lot of the grunt work.

 

Microsoft.Build.Framework.dll – has a set of interfaces that define the way the engine talks with tasks and loggers.

 

Microsoft.Build.Conversion.dll – has code that converts from VS .NET 2003 project format to Whidbey MSBuild format.

 

The DLLs are also registered in the GAC.

 

All C# and VB build logic in Whidbey is expressed in terms of “Targets” files. These are XML files that contain script in the MSBuild language:

 

Microsoft.Common.targets – most of the work is done here.

Microsoft.CSharp.targets – contains the part of the build logic that is specific to C#.

Microsoft.VisualBasic.targets – contains the part of the build logic that is specific to VB.

 

Finally, there is:

 

Microsoft.Common.tasks – an XML file that shows the default tasks that are available to every build script.

 

Now for the hack of the day. Try this from the C:\WINDOWS\Microsoft.NET\Framework\v2.0.xxxx folder:

 

for /F %i in ('dir *.tasks *.targets /s/b') do @type %i | findstr /i "UsingTask"

 

This should list the name of every MSBuild task available out of the box, including the undocumented ones.

 

This posting is provided "AS IS" with no warranties, and confers no rights.