Engine Class

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)

'Declaration
Public Class Engine
'Usage
Dim instance As Engine

public class Engine
public class Engine

In a system of project-to-project dependencies, the Engine maintains the building projects, making it possible to avoid building the same target in the same project more than once in a given build.

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

System.Object
  Microsoft.Build.BuildEngine.Engine

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show: