Integrate Build Scripts with Tasks

Your source files might not be using an MSBuild or an Eclipse project to build. They might be using a build script instead. In this case, you can create a custom build task that uses the build script.

Micro Focus recommends that you define your own custom shell tasks to invoke the build script. The Micro Focus COBOL extension includes a COBOL-shell task type that make the required compilation tools (such as cobol.exe (on Windows) and cob (on Linux)) are available to the build script. This requires the location of the licensed Micro Focus Visual COBOL or Enterprise Developer product to be set in the Visual Studio Code settings.

The default install location is C:\Program Files (x86)\Micro Focus\Visual COBOL or C:\Program Files (x86)\Micro Focus\Enterprise Developer (for Windows), or /opt/microfocus/VisualCOBOL or /opt/microfocus/EnterpriseDeveloper (for Linux) depending on whether you installed Visual COBOL or Enterprise Developer.

To configure a custom build task to use the COBOL-shell task type you add it to the existing tasks.json file in the editor. The following example shows a COBOL build task that invokes a batch file, build.bat. build.bat is then able to use cobol.exe to compile COBOL sources:

        {
           "label": "My custom build",
           "type": "COBOL-shell",
           "command": ".\\build.bat",
           "problemMatcher": "$COBOLErrFormat3",
           "group": "build"
        }

The new custom task, My custom build, will be available when you choose Terminal > Run Build Task.