Partilhar via


VCFileConfiguration.Compile(Boolean, Boolean) Method

Definition

Compiles the selected file or reference.

public:
 void Compile(bool forceBuild, bool waitOnBuild);
public:
 void Compile(bool forceBuild, bool waitOnBuild);
void Compile(bool forceBuild, bool waitOnBuild);
[System.Runtime.InteropServices.DispId(516)]
public void Compile (bool forceBuild, bool waitOnBuild);
[<System.Runtime.InteropServices.DispId(516)>]
abstract member Compile : bool * bool -> unit
Public Sub Compile (forceBuild As Boolean, waitOnBuild As Boolean)

Parameters

forceBuild
Boolean

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

waitOnBuild
Boolean

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

Attributes

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  

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.

Applies to