Engine Class
Note: This API is now obsolete.
Represents the MSBuild engine.
MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.
Inheritance Hierarchy
System.Object
Microsoft.Build.BuildEngine.Engine
Namespace: Microsoft.Build.BuildEngine
Assembly: Microsoft.Build.Engine (in Microsoft.Build.Engine.dll)
Syntax
'Declaration
<ObsoleteAttribute("This class has been deprecated. Please use Microsoft.Build.Evaluation.ProjectCollection from the Microsoft.Build assembly instead.")> _
Public Class Engine
[ObsoleteAttribute("This class has been deprecated. Please use Microsoft.Build.Evaluation.ProjectCollection from the Microsoft.Build assembly instead.")]
public class Engine
[ObsoleteAttribute(L"This class has been deprecated. Please use Microsoft.Build.Evaluation.ProjectCollection from the Microsoft.Build assembly instead.")]
public ref class Engine
[<ObsoleteAttribute("This class has been deprecated. Please use Microsoft.Build.Evaluation.ProjectCollection from the Microsoft.Build assembly instead.")>]
type Engine = class end
public class Engine
The Engine type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Engine() | Initializes a new instance of the Engine class.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
Engine(String) | Obsolete. Initializes a new instance of the Engine class that has the specified BinPath.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
Engine(BuildPropertyGroup) | Initializes a new instance of the Engine class.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
Engine(ToolsetDefinitionLocations) | Initializes a new instance of the Engine class.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
Engine(BuildPropertyGroup, ToolsetDefinitionLocations) | Initializes a new instance of the Engine class.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
Engine(BuildPropertyGroup, ToolsetDefinitionLocations, Int32, String) | Initializes a new instance of the Engine class.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. |
Top
Properties
Name | Description | |
---|---|---|
BinPath | Obsolete. Gets or sets the path to MSBuild.exe.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
BuildEnabled | Gets or sets a value that indicates whether the building of targets in the project is enabled.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
DefaultToolsVersion | The default ToolsVersion of this build engine.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
GlobalEngine | Gets the Engine that is global (shared) for this AppDomain.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
GlobalProperties | Gets or sets a collection of the global properties for the project.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
IsBuilding | Gets whether a project is currently being built.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
OnlyLogCriticalEvents | Gets or sets a value that indicates whether to only log critical events, such as warnings and errors, during the build.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
Toolsets | Sets or Gets the collection of Toolsets that are recognized by this build engine instance.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
Version | Gets the version of the Engine.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. |
Top
Methods
Name | Description | |
---|---|---|
BuildProject(Project) | Builds the specified Project.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
BuildProject(Project, String) | Builds the specified target of the specified Project.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
BuildProject(Project, array<String[]) | Builds the specified targets of the specified Project.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
BuildProject(Project, array<String[], IDictionary) | Builds the specified targets of the specified Project, and returns the outputs of the targets.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
BuildProject(Project, array<String[], IDictionary, BuildSettings) | Builds the specified targets of the specified Project with the specified BuildSettings, and returns the outputs of the targets.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
BuildProjectFile(String) | Loads the specified project file and builds the project.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
BuildProjectFile(String, String) | Loads the specified project file and builds the specified target of the project.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
BuildProjectFile(String, array<String[]) | Loads the specified project file and builds the specified targets of the project.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
BuildProjectFile(String, array<String[], BuildPropertyGroup) | Loads the specified project file and builds the specified targets of the project with the specified GlobalProperties, and returns the outputs of the targets.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
BuildProjectFile(String, array<String[], BuildPropertyGroup, IDictionary) | Loads the specified project file and builds the specified targets of the project with the specified GlobalProperties, and returns the outputs of the targets.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
BuildProjectFile(String, array<String[], BuildPropertyGroup, IDictionary, BuildSettings) | Loads the specified project file and builds the specified targets of the project with the specified BuildSettings and GlobalProperties, and returns the outputs of the targets.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
BuildProjectFile(String, array<String[], BuildPropertyGroup, IDictionary, BuildSettings, String) | Loads a project file from disk and builds the given targets.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
BuildProjectFiles | Loads a set of project files from disk and then builds the given list of targets for each project.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
CreateNewProject | Creates an empty Project object that is associated with this Engine.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
GetHashCode | (Inherited from Object.) | |
GetLoadedProject | Returns the Project object that is associated with the specified project file.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
GetType | (Inherited from Object.) | |
MemberwiseClone | (Inherited from Object.) | |
RegisterDistributedLogger | Registers distributed loggers with the build engine.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
RegisterLogger | Registers the specified logger with the Engine.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
Shutdown | Called when the host is finished with this build engine. It unregisters loggers and shuts down nodes.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
ToString | (Inherited from Object.) | |
UnloadAllProjects | Removes all references to Project objects from the Engine.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
UnloadProject | Removes the reference to the specified Project from the Engine.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. | |
UnregisterAllLoggers | Unregisters all loggers from the Engine.MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0. |
Top
Remarks
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.
Examples
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
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Build.BuildEngine;
namespace BuildAProjectCS
{
class Program
{
static void Main(string[] args)
{
// Instantiate a new Engine object
Engine engine = 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 build log
FileLogger logger = new FileLogger();
// Set the logfile parameter to indicate the log destination
logger.Parameters = @"logfile=C:\temp\build.log";
// Register the logger with the engine
engine.RegisterLogger(logger);
// Build a project file
bool success = engine.BuildProjectFile(@"c:\temp\validate.proj");
//Unregister all loggers to close the log file
engine.UnregisterAllLoggers();
if (success)
Console.WriteLine("Build succeeded.");
else
Console.WriteLine(@"Build failed. View C:\temp\build.log for details");
}
}
}
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.