VCFileConfiguration::Compile Method (Boolean, Boolean)

 

Compiles the selected file or reference.

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

void Compile(
	bool forceBuild,
	bool waitOnBuild
)

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.

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 forceBuild is true and waitOnBuild is false. If you depend on the build for output, you should set waitOnBuild to true.

' 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
Return to top
Show: