Welcome to MSDN Blogs Sign in | Join | Help

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.

 

Published Friday, September 10, 2004 4:18 PM by Jomo Fisher

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Hack the Build: Target Overriding Step-by-Step

Thursday, September 16, 2004 5:28 PM by Hack the Build: Ramblings of an MSBuild Developer

# re: Hack the Build: Lay of the Land

> Microsoft.Build.Conversion.dll – has code that converts from VS .NET 2003 project format to Whidbey MSBuild format.
>
What about VS.NET 2002? Will it choke on them?

Is there any chance you could post something about how MSBuild handes non-MSBuild file formats? For example .sln, .vcproj and old MSBuild versions. Is this mechanism extensible at all? Might it be possible to convert VS.NET 2003 projects (and maybe even NAnt projects) on the fly?

Thanks, Jamie.
Thursday, September 16, 2004 8:29 PM by Jamie Cansdale

# .NET CF 2.0

Wednesday, July 06, 2005 7:33 PM by Impersonation Failure

# MSBuild rocks but CF 2.0 still broken

Wednesday, July 06, 2005 7:55 PM by Impersonation Failure

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker