Engine.BuildProjectFile Método
Definição
Carrega o arquivo de projeto especificado e compila o projeto.Loads the specified project file and builds the project.
Sobrecargas
| BuildProjectFile(String, String[], BuildPropertyGroup, IDictionary, BuildSettings, String) |
Carrega um arquivo de projeto do disco e compila os destinos fornecidos.Loads a project file from disk and builds the given targets. |
| BuildProjectFile(String, String[], BuildPropertyGroup, IDictionary, BuildSettings) |
Compila os arquivos de projeto especificados e compila os destinos indicados do projeto com o BuildSettings e GlobalProperties definidos, e retorna as saídas dos destinos.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. |
| BuildProjectFile(String, String[], BuildPropertyGroup) |
Compila os arquivos de projeto especificados e compila os destinos indicados do projeto com o GlobalProperties definido e retorna as saídas dos destinos.Loads the specified project file and builds the specified targets of the project with the specified GlobalProperties, and returns the outputs of the targets. |
| BuildProjectFile(String, String[], BuildPropertyGroup, IDictionary) |
Compila os arquivos de projeto especificados e compila os destinos indicados do projeto com o GlobalProperties definido e retorna as saídas dos destinos.Loads the specified project file and builds the specified targets of the project with the specified GlobalProperties, and returns the outputs of the targets. |
| BuildProjectFile(String, String) |
Carrega o arquivo de projeto especificado e compila o destino do projeto indicado.Loads the specified project file and builds the specified target of the project. |
| BuildProjectFile(String) |
Carrega o arquivo de projeto especificado e compila o projeto.Loads the specified project file and builds the project. |
| BuildProjectFile(String, String[]) |
Carrega o arquivo de projeto especificado e compila os destinos do projeto indicado.Loads the specified project file and builds the specified targets of the project. |
Exemplos
O exemplo a seguir cria um objeto Engine e usa o método BuildProjectFile para compilar um arquivo de projeto.The following example creates an Engine object and uses the BuildProjectFile method to build a project file. A classe FileLogger é usada para registrar em log as informações em um arquivo.The FileLogger class is used to log information to a file.
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");
}
}
}
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
BuildProjectFile(String, String[], BuildPropertyGroup, IDictionary, BuildSettings, String)
Carrega um arquivo de projeto do disco e compila os destinos fornecidos.Loads a project file from disk and builds the given targets.
public:
bool BuildProjectFile(System::String ^ projectFile, cli::array <System::String ^> ^ targetNames, Microsoft::Build::BuildEngine::BuildPropertyGroup ^ globalProperties, System::Collections::IDictionary ^ targetOutputs, Microsoft::Build::BuildEngine::BuildSettings buildFlags, System::String ^ toolsVersion);
public bool BuildProjectFile (string projectFile, string[] targetNames, Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSettings buildFlags, string toolsVersion);
member this.BuildProjectFile : string * string[] * Microsoft.Build.BuildEngine.BuildPropertyGroup * System.Collections.IDictionary * Microsoft.Build.BuildEngine.BuildSettings * string -> bool
Public Function BuildProjectFile (projectFile As String, targetNames As String(), globalProperties As BuildPropertyGroup, targetOutputs As IDictionary, buildFlags As BuildSettings, toolsVersion As String) As Boolean
Parâmetros
- projectFile
- String
O nome do projeto a ser compilado.The name of the project to build.
- targetNames
- String[]
Uma matriz BuildPropertyGroup de destinos para cada projeto.A BuildPropertyGroup array of targets for each project. Pode ser null se você deseja compilar os destinos padrão para o projeto.Can be null if you want to build the default targets for the project.
- globalProperties
- BuildPropertyGroup
Uma matriz IDictionary de propriedades para cada projeto.An IDictionary array of properties for each project. Pode ser null se nenhuma propriedade global for necessária.Can be null if no global properties are required.
- targetOutputs
- IDictionary
Uma matriz BuildSettings de tabelas para saídas de destino.A BuildSettings array of tables for target outputs. Pode ser null se as saídas não são necessárias.Can be null if outputs are not required.
- buildFlags
- BuildSettings
Uma matriz de cadeia de caracteres de sinalizadores de build adicionais.A string array of additional build flags.
- toolsVersion
- String
A ToolsVersion a ser importa sobre o projeto neste build.The ToolsVersion to impose on the project in this build.
Retornos
true se o build for bem-sucedido; caso contrário, false.true if the build succeeds; otherwise, false.
Comentários
Essa sobrecarga usa um conjunto de propriedades globais para cada projeto a ser usado para a compilação, retorna as saídas de destino e também permite que o chamador especifique sinalizadores de compilação adicionais.This overload takes a set of global properties for each project to use for the build, returns the target outputs, and also enables the caller to specify additional build flags.
Aplica-se a
BuildProjectFile(String, String[], BuildPropertyGroup, IDictionary, BuildSettings)
Compila os arquivos de projeto especificados e compila os destinos indicados do projeto com o BuildSettings e GlobalProperties definidos, e retorna as saídas dos destinos.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.
public:
bool BuildProjectFile(System::String ^ projectFile, cli::array <System::String ^> ^ targetNames, Microsoft::Build::BuildEngine::BuildPropertyGroup ^ globalProperties, System::Collections::IDictionary ^ targetOutputs, Microsoft::Build::BuildEngine::BuildSettings buildFlags);
public bool BuildProjectFile (string projectFile, string[] targetNames, Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties, System.Collections.IDictionary targetOutputs, Microsoft.Build.BuildEngine.BuildSettings buildFlags);
member this.BuildProjectFile : string * string[] * Microsoft.Build.BuildEngine.BuildPropertyGroup * System.Collections.IDictionary * Microsoft.Build.BuildEngine.BuildSettings -> bool
Public Function BuildProjectFile (projectFile As String, targetNames As String(), globalProperties As BuildPropertyGroup, targetOutputs As IDictionary, buildFlags As BuildSettings) As Boolean
Parâmetros
- projectFile
- String
O arquivo de projeto a ser carregado e compilado.The project file to load and build.
- targetNames
- String[]
Uma matriz que contém os atributos Name dos elementos de destino a serem criados.An array that contains the Name attributes of the Target elements to build.
- globalProperties
- BuildPropertyGroup
O GlobalProperties a ser aplicado ao build.The GlobalProperties to apply to the build.
- targetOutputs
- IDictionary
As saídas dos destinos compilados.The outputs of the built targets. Este parâmetro pode ser uma referência nula (Nothing no Visual Basic) caso as saídas não sejam necessárias.This parameter can be a null reference (Nothing in Visual Basic) if outputs are not required.
- buildFlags
- BuildSettings
O BuildSettings a ser aplicado ao build.The BuildSettings to apply to the build.
Retornos
true caso o build tenha sido bem-sucedido; do contrário, false.true if the build was successful; otherwise, false.
Aplica-se a
BuildProjectFile(String, String[], BuildPropertyGroup)
Compila os arquivos de projeto especificados e compila os destinos indicados do projeto com o GlobalProperties definido e retorna as saídas dos destinos.Loads the specified project file and builds the specified targets of the project with the specified GlobalProperties, and returns the outputs of the targets.
public:
bool BuildProjectFile(System::String ^ projectFile, cli::array <System::String ^> ^ targetNames, Microsoft::Build::BuildEngine::BuildPropertyGroup ^ globalProperties);
public bool BuildProjectFile (string projectFile, string[] targetNames, Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties);
member this.BuildProjectFile : string * string[] * Microsoft.Build.BuildEngine.BuildPropertyGroup -> bool
Public Function BuildProjectFile (projectFile As String, targetNames As String(), globalProperties As BuildPropertyGroup) As Boolean
Parâmetros
- projectFile
- String
O arquivo de projeto a ser carregado e compilado.The project file to load and build.
- targetNames
- String[]
Uma matriz que contém os atributos Name dos elementos de destino a serem criados.An array that contains the Name attributes of the Target elements to build.
- globalProperties
- BuildPropertyGroup
O GlobalProperties a ser aplicado ao build.The GlobalProperties to apply to the build.
Retornos
true caso o build tenha sido bem-sucedido; do contrário, false.true if the build was successful; otherwise, false.
Aplica-se a
BuildProjectFile(String, String[], BuildPropertyGroup, IDictionary)
Compila os arquivos de projeto especificados e compila os destinos indicados do projeto com o GlobalProperties definido e retorna as saídas dos destinos.Loads the specified project file and builds the specified targets of the project with the specified GlobalProperties, and returns the outputs of the targets.
public:
bool BuildProjectFile(System::String ^ projectFile, cli::array <System::String ^> ^ targetNames, Microsoft::Build::BuildEngine::BuildPropertyGroup ^ globalProperties, System::Collections::IDictionary ^ targetOutputs);
public bool BuildProjectFile (string projectFile, string[] targetNames, Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties, System.Collections.IDictionary targetOutputs);
member this.BuildProjectFile : string * string[] * Microsoft.Build.BuildEngine.BuildPropertyGroup * System.Collections.IDictionary -> bool
Public Function BuildProjectFile (projectFile As String, targetNames As String(), globalProperties As BuildPropertyGroup, targetOutputs As IDictionary) As Boolean
Parâmetros
- projectFile
- String
O arquivo de projeto a ser carregado e compilado.The project file to load and build.
- targetNames
- String[]
Uma matriz que contém os atributos Name dos elementos de destino a serem criados.An array that contains the Name attributes of the Target elements to build.
- globalProperties
- BuildPropertyGroup
O GlobalProperties a ser aplicado ao build.The GlobalProperties to apply to the build.
- targetOutputs
- IDictionary
As saídas dos destinos compilados.The outputs of the built targets. Este parâmetro pode ser uma referência nula (Nothing no Visual Basic) caso as saídas não sejam necessárias.This parameter can be a null reference (Nothing in Visual Basic) if outputs are not required.
Retornos
true caso o build tenha sido bem-sucedido; do contrário, false.true if the build was successful; otherwise, false.
Aplica-se a
BuildProjectFile(String, String)
Carrega o arquivo de projeto especificado e compila o destino do projeto indicado.Loads the specified project file and builds the specified target of the project.
public:
bool BuildProjectFile(System::String ^ projectFile, System::String ^ targetName);
public bool BuildProjectFile (string projectFile, string targetName);
member this.BuildProjectFile : string * string -> bool
Public Function BuildProjectFile (projectFile As String, targetName As String) As Boolean
Parâmetros
- projectFile
- String
O arquivo de projeto a ser carregado e compilado.The project file to load and build.
- targetName
- String
O atributo Name do elemento de destino a ser compilado.The Name attribute of the Target element to build.
Retornos
true caso o build tenha sido bem-sucedido; do contrário, false.true if the build was successful; otherwise, false.
Aplica-se a
BuildProjectFile(String)
Carrega o arquivo de projeto especificado e compila o projeto.Loads the specified project file and builds the project.
public:
bool BuildProjectFile(System::String ^ projectFile);
public bool BuildProjectFile (string projectFile);
member this.BuildProjectFile : string -> bool
Public Function BuildProjectFile (projectFile As String) As Boolean
Parâmetros
- projectFile
- String
O arquivo de projeto a ser carregado e compilado.The project file to load and build.
Retornos
true caso o build tenha sido bem-sucedido; do contrário, false.true if the build was successful; otherwise, false.
Exemplos
O exemplo a seguir cria um objeto Engine e usa o método BuildProjectFile para compilar um arquivo de projeto.The following example creates an Engine object and uses the BuildProjectFile method to build a project file. A classe FileLogger é usada para registrar em log as informações em um arquivo.The FileLogger class is used to log information to a file.
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");
}
}
}
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
Aplica-se a
BuildProjectFile(String, String[])
Carrega o arquivo de projeto especificado e compila os destinos do projeto indicado.Loads the specified project file and builds the specified targets of the project.
public:
bool BuildProjectFile(System::String ^ projectFile, cli::array <System::String ^> ^ targetNames);
public bool BuildProjectFile (string projectFile, string[] targetNames);
member this.BuildProjectFile : string * string[] -> bool
Public Function BuildProjectFile (projectFile As String, targetNames As String()) As Boolean
Parâmetros
- projectFile
- String
O arquivo de projeto a ser carregado e compilado.The project file to load and build.
- targetNames
- String[]
Uma matriz que contém os atributos Name dos elementos de destino a serem criados.An array that contains the Name attributes of the Target elements to build.
Retornos
true caso o build tenha sido bem-sucedido; do contrário, false.true if the build was successful; otherwise, false.