Freigeben über


BeforeBuild Event

Occurs before a project is rebuilt or an application file (.app), dynamic link library (.dll), or executable file (.exe) is created from a project.

PROCEDURE Object.BeforeBuild
LPARAMETERS cOutputName, nBuildAction, lRebuildAll, lShowErrors, lBuildNewGuids

Parameters

  • cOutputName
    Specifies the name of the application, dynamic link library, or executable file that is created.

    If cOutputName includes a file extension and nBuildAction is omitted, the file extension in cOutputName determines the type of file built. For example, if the extension in cOutputName is ".exe" an executable file is created.

  • nBuildAction
    Specifies that the project is rebuilt or generates an application, a dynamic link library, or an executable file.

    The following table lists the values for nBuildAction with a description of each.

    nBuildAction FoxPro.h constant Description
    1 BUILDACTION_REBUILD Rebuilds the project
    2 BUILDACTION_BUILDAPP Creates an .app
    3 BUILDACTION_BUILDEXE Creates an .exe
    4 BUILDACTION_BUILDDLL Creates a .dll
    5 BUILDACTION_BUILDMTDLL Creates a multi-threaded .dll

    nBuildAction takes precedence over the file extension specified in cOutPutName. For example, an executable file is created if nBuildAction is 3 and cOutputName doesn't specify an ".exe" extension.

  • lRebuildAll
    Specifies whether files in the project are recompiled before an .app, .dll, or .exe is created. If lRebuildAll is True (.T.), the following are recompiled:

    • Program files
    • Format files
    • Source code in forms, labels, reports, and visual class libraries
    • Stored procedures in databases

    If lRebuildAll is False (.F.) or is omitted, files in the project are not recompiled before the .app, .dll, or .exe is created.

  • lShowErrors
    Specifies whether compilation errors are displayed in an editing window after the build is complete. If lShowErrors is True (.T.), the errors are displayed. If lShowErrors is False (.F.) or is omitted, compilation errors aren't displayed.

  • lBuildNewGUIDs
    Specifies whether new registry GUIDs (globally unique identifiers) are generated when an executable file or dynamic link library is created. If lBuildNewGUIDs is True (.T.), new GUIDs are generated. If lBuildNewGUIDs is False (.F.) or is omitted, new GUIDs aren't generated. lBuildNewGUIDs is ignored if nBuildAction is less than 3.

Remarks

The parameters listed above are passed to the BeforeBuild event when you execute the Build method, when you issue the BUILD APP, BUILD DLL, BUILD EXE, or BUILD PROJECT commands, or when you choose OK in the Build Options dialog box. The parameters are passed by reference with the exception of the nBuildAction parameter, which is passed by value. You can change the values of these parameters within the BeforeBuild event to change how a project, .app, .dll, or .exe is created from the project.

Include NODEFAULT in the BeforeBuild event to prevent a project from being rebuilt or an application file (.app), dynamic link library (.dll), or executable file (.exe) from being created.

See Also

AfterBuild Event | Build Method | BUILD PROJECT Command

Applies To: ProjectHook Object