共用方式為


Engine.BuildProjectFile Method (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.

Namespace:  Microsoft.Build.BuildEngine
Assembly:  Microsoft.Build.Engine (in Microsoft.Build.Engine.dll)

Syntax

'Declaration
Public Function BuildProjectFile ( _
    projectFile As String, _
    targetNames As String(), _
    globalProperties As BuildPropertyGroup, _
    targetOutputs As IDictionary, _
    buildFlags As BuildSettings, _
    toolsVersion As String _
) As Boolean
public bool BuildProjectFile(
    string projectFile,
    string[] targetNames,
    BuildPropertyGroup globalProperties,
    IDictionary targetOutputs,
    BuildSettings buildFlags,
    string toolsVersion
)
public:
bool BuildProjectFile(
    String^ projectFile, 
    array<String^>^ targetNames, 
    BuildPropertyGroup^ globalProperties, 
    IDictionary^ targetOutputs, 
    BuildSettings buildFlags, 
    String^ toolsVersion
)
member BuildProjectFile : 
        projectFile:string * 
        targetNames:string[] * 
        globalProperties:BuildPropertyGroup * 
        targetOutputs:IDictionary * 
        buildFlags:BuildSettings * 
        toolsVersion:string -> bool
public function BuildProjectFile(
    projectFile : String, 
    targetNames : String[], 
    globalProperties : BuildPropertyGroup, 
    targetOutputs : IDictionary, 
    buildFlags : BuildSettings, 
    toolsVersion : String
) : boolean

Parameters

  • projectFile
    Type: System.String

    The name of the project to build.

  • targetNames
    Type: array<System.String[]

    A BuildPropertyGroup array of targets for each project. Can be nulla null reference (Nothing in Visual Basic) if you want to build the default targets for the project.

  • toolsVersion
    Type: System.String

    The ToolsVersion to impose on the project in this build.

Return Value

Type: System.Boolean
true if the build succeeds; otherwise, false.

Remarks

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.

.NET Framework Security

See Also

Reference

Engine Class

BuildProjectFile Overload

Microsoft.Build.BuildEngine Namespace