This documentation is archived and is not being maintained.
Engine Class
Visual Studio 2008
Represents the MSBuild engine.
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 '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 path that contains the .NET Framework 2.0 CLR and 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") 'Unregister all loggers to close the log file engine.UnregisterAllLoggers() If success Then Console.WriteLine("Build succeeded.") Else Console.WriteLine("Build failed. View C:\temp\build.log for details.") End If End Sub End Module
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: