Upgrading existing .NET COBOL project files

This topic contains important information about using the latest release to edit .NET COBOL projects created with earlier versions of Visual COBOL.

Upgrading existing projects to release 10.0

Release 10.0 comes with support for .NET 8 and with newer versions of the Visual COBOL SDK and the NuGet packages. Earlier versions of the .NET are not supported.

Upgrading existing projects in release 9.0

The 9.0 release introduces the following changes:

  • NuGet package changes - the 9.0 release installs several NuGet packages each of which contains the assemblies for a specific Visual COBOL functionality. New .NET projects, as well as existing projects you edit or build in 9.0 are linked to a core package, MicroFocus.COBOL.Runtime.Core, that includes the basic functionality for the projects. You need to add any additional packages (such as a specific file handler, COBOL Accept/Display etc.) manually to the projects.

    Building existing .NET COBOL projects created prior to 9.0 might result in build errors. To ensure compatibility for older projects, 9.0 also provides a MicroFocus.COBOL.Runtime metapackage. You can either enable this or add any required new NuGet packages manually to them.

    See To package Micro Focus assemblies with a .NET application for details.

  • Newer SDK version - the Visual COBOL SDK version has changed from version 2.0 in release 8.0 to version 2.1.

    Updating the SDK means that projects will reference the MicroFocus.COBOL.Runtime.Core package. This is how you can avoid receiving any build errors due to the change:

    • If you compile any existing projects from the command line, you might get build errors as the SDK links the project to MicroFocus.COBOL.Runtime.Core. You can switch off the new behavior and avoid any build errors this in one of the following ways:
      • Specify the environment variable DisableCOBOLRuntimeMetapackage=false.
      • Edit the project file in a text editor, and add <DisableCOBOLRuntimeMetapackage>false</DisableCOBOLRuntimeMetapackage> to the PropertyGroup section.

Upgrading from releases earlier than 7.0

You cannot use dotnet commands to work with .NET projects (previously .NET Core projects) that were created using a version of Visual COBOL before 7.0. Instead, you can upgrade them in order to be able to use the dotnet commands.

To upgrade a pre-7.0 project file so that you can use the project with dotnet commands you need to do the following:

  1. Modify the project (.cblproj) file as follows:
    1. Change the first line from:
      <Project Sdk="Microsoft.NET.Sdk">
      to:
      <Project Sdk="MicroFocus.Sdk"
    2. Delete the two lines that start with the following:
      <LanguageTargets
  2. Create a global.json file in the project folder to define the version of the Micro Focus project SDK to use. For example:
    {
        "msbuild-sdks": {
            "MicroFocus.Sdk": "1.0.16"
        }
    }

    For more information on modifying your .cblproj and global.json files to do this, see Microsoft: How to: Use MSBuild project SDKs.