This topic contains important information about using the latest release to edit .NET COBOL projects created with earlier versions of Visual COBOL.
The 9.0 release introduces the following changes:
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.
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:
Visual Studio 2022 requires that the global.json file of .NET 6 projects is placed at the directory level of the solution file in order for the project to successfully open and build. In previous versions of Visual Studio, the file could be located in subfolders of the solution such as in the project folder.
This can affect existing .NET Core 3.1 COBOL projects that you upgrade from a prior release if the global.json file is not at the directory level of the solution file. It also affects .NET 6 COBOL projects that you add to an existing solution.
In these cases, you might receive the following error message if building from the MSBuild command line, or in the Output window inside Visual Studio if the project fails to load:
"The SDK 'MicroFocus.Sdk' specified could not be found"
To work around this issue, you need to move the global.json file to the directory level of the solution file.
New .NET 6 COBOL solutions and projects created with Visual Studio 2022 create the global.json file in the required location.
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 either continue to use such projects using the Visual Studio IDE and the msbuild command, or 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:
<Project Sdk="Microsoft.NET.Sdk">to:
<Project Sdk="MicroFocus.Sdk"
<LanguageTargets
{ "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.