Compartir a través de


VCFileConfiguration.Compile Method

Compiles the selected file or reference.

Namespace:  Microsoft.VisualStudio.VCProjectEngine
Assembly:  Microsoft.VisualStudio.VCProjectEngine (in Microsoft.VisualStudio.VCProjectEngine.dll)

Syntax

'Declaration
Sub Compile ( _
    forceBuild As Boolean, _
    waitOnBuild As Boolean _
)
void Compile(
    bool forceBuild,
    bool waitOnBuild
)
void Compile(
    [InAttribute] bool forceBuild, 
    [InAttribute] bool waitOnBuild
)
abstract Compile : 
        forceBuild:bool * 
        waitOnBuild:bool -> unit
function Compile(
    forceBuild : boolean, 
    waitOnBuild : boolean
)

Parameters

  • forceBuild
    Type: System.Boolean

    A Boolean value that determines whether to force build. true if yes, false if no.

  • waitOnBuild
    Type: System.Boolean

    A Boolean value that determines whether to wait on build. true if yes, false if no.

Remarks

If forceBuild is set to true, compilation does not occur unless the project is out of date. When you initiate a compilation in the user interface (UI) by right-clicking a project, it is the same as if forceBuildis true and waitOnBuildis false. If you depend on the build for output, you should set waitOnBuild to true.

Examples

' Compiles the first project in the solution.
' Add a reference to Microsoft.VisualStudio.VCProjectEngine and have 
' a Visual C++ project loaded before running this example.
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine
Public Module Module1
Sub Test()
        Dim file As VCFile
        Dim col As IVCCollection
        Dim fileconfig As VCFileConfiguration
        Dim prj As VCProject
        prj = DTE.Solution.Projects.Item(1).Object
        col = prj.Files
        file = col.Item(1)
        col = file.FileConfigurations
        fileconfig = col.Item("Debug|Win32")
        fileconfig.Compile(False, True)
    End Sub

.NET Framework Security

See Also

Reference

VCFileConfiguration Interface

Microsoft.VisualStudio.VCProjectEngine Namespace