These are the steps to use the Project from Existing Code wizard in Visual Studio to create and configure a project:
- Locate the existing COBOL files that you need to import in the Visual Studio IDE.
- In the IDE, click
- Ensure the directives are set as appropriate.
The directives set on this page are set on imported files. For example, you can choose to set the dialect directive or various
SQL directives. After the files are imported in the project, the IDE performs an additional directives scanning of them and
sets the directives as necessary.
- Ensure any file extensions that are not traditionally associated with COBOL will be recognized as COBOL programs or copybooks.
To associate file extensions with COBOL and
To specify that a file extension is a copybook for details.
File > New > Project from Existing Code to invoke the wizard.
- On the Welcome page, ensure
Micro Focus COBOL is selected as the project type to create.
- On the
Specify Project Location, Project Type and Source Files page, specify a directory, a name and an output type for the Visual Studio project.
You do not need to specify the
cblproj extension in the name as the wizard adds it automatically.
- Specify the folders that contain the source files to import into your project:
- Browse to the folder that contains the source files and select it.
Add subfolders if you want to add files from all subfolders.
- Repeat and add other folders as needed.
File types to add to the project lists all file extensions that you want to add to your project.
Add copybooks to Solution Explorer if you want to show the copybook files as part of the project in Solution Explorer.
- On the
Specify New COBOL Project Properties page, specify whether to create a native or a managed project.
- For native projects, select the target platforms.
Visual Studio starts importing the files which is an asynchronous process so the IDE will be unresponsive to any other events
till the import is complete.
During file import, the wizard:
- Creates a Visual Studio project in the specified directory.
- Scans the files in the source folders to determine which ones are COBOL programs and which are copybooks.
- Imports the files of the selected file types into your project:
- If the source files are in the same folder, the wizard adds them to the project and re-creates the subfolder structure.
- If the source files are stored in other folders, the wizard only links them to your project.
- Adds the paths to the source folders that contain copybook files to the COBCPY environment variable as paths relative to the
To see what paths are set for the project, click
ProjectName Properties and check the
Copybook Paths tab.
- Adds the copybooks to the project in Solution Explorer (if you specified this in the wizard).
- Sets the
Compile build action on files which it identified as COBOL programs.
Copybook files do not compile so no build action is set on them.
- Performs a directives scan of the imported files and sets additional directives as specified in
- Displays a summary report about the files it imported, the directives and copybooks paths that it set in the
- Check the
Output window for summary report of the actions the wizard performed. From the drop-down list next to
Show output from choose:
- Import Files Results - shows a list of the files that were imported and the copybooks paths that were added to the COBCPY environment variable.
- General - shows results from the file scan and the directives that were set as specified in