Engine Class
.NET Framework 2.0
Note: This class is new in the .NET Framework version 2.0.
Represents the MSBuild engine.
Namespace: Microsoft.Build.BuildEngine
Assembly: Microsoft.Build.Engine (in microsoft.build.engine.dll)
Assembly: Microsoft.Build.Engine (in microsoft.build.engine.dll)
The following example creates an Engine object and uses the BuildProjectFile method to build a project file. The FileLogger class is used to log information to a file.
Module Module1 'You need to add references to Microsoft.Build.Framework and 'Microsoft.Build.BuildEngine Sub Main() 'Create a new Engine object Dim engine As New Engine() 'Point to the correct path that contains the 2.0 clr/tools engine.BinPath = "c:\windows\microsoft.net\framework\v2.0.xxxxx" 'Instantiate a new FileLogger to generate a build log Dim logger As New FileLogger() 'Set logfile parameter to indicate the log destination logger.Parameters = "logfile=c:\temp\build.log" 'Register the logger with the engine engine.RegisterLogger(logger) 'Build the project file Dim success As Boolean = engine.BuildProjectFile("c:\temp\validate.proj") If success Then Console.WriteLine("Build successful") Else Console.WriteLine("Build failed - view the log") End If End Sub End Module
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Community Additions
ADD
Show: