Developing ECI and ESI applications based on the Microsoft .NET Core
How to develop ECI and ESI applications by using the .NET Core.
Developing using Microsoft Visual Studio
If you are developing by using Microsoft Visual Studio, you must add a reference to the IBM.CTG.Core.dll assembly.
When you add the reference, the types in the IBM®.CTG namespace can be used to perform ECI and ESI calls to CICS®. To avoid the need to fully qualify each type, you can add the IBM.CTG namespace to the imports section of your code.
See Microsoft Visual Studio documentation for further information on creating and building projects.
Developing using csproj format
Microsoft .NET Core uses csproj format that is used by MSBuild to build the projects. Because of the changes in .NET Core and .NET Framework, following must be present in csproj file.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Reference Include="IBM.CTG.Core">
<SpecificVersion>False</SpecificVersion>
<HintPath>IBM.CTG.Core.dll</HintPath> </Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
</ItemGroup>
<PropertyGroup> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOu
tputType> </PropertyGroup>
</Project>
Ensure that IBM.CTG.Core.dll is made available in the mentioned Hintpath.
Changes in Configuration File
Microsoft has changed the way application configuration is stored and referenced in a .NET Core application. They should now be stored in JSON format as shown in the following section. CICS TG mandates that for every project there must be a file appsettings.json, which should store all the configuration parameters that are required by CICS TG. If there is no configuration that is specified, an empty appsettings.json must be provided.
Example of appsettings.json containing CTGApplid and CTGApplidQualifier.
{
"CtgApplid": "CTGAPP",
"CtgApplidQualifier": "IBM"
}
{ }
Compiling and linking from the command line
The .NET Core provides command line tools for compiling and linking .NET Core applications. IBM.CTG.Core.dll depends on some specific packages that are provided by Microsoft .NET Core. These packages should be added to any application that is using CICS TG ECI V2 APIs.
To add these packages to your .NET Core application, run the following commands.
dotnet add package Microsoft.Extensions.Configuration --version 2.0.0
dotnet add package Microsoft.Extensions.Configuration.Abstractions --version 2.0.0
dotnet add package Microsoft.Extensions.Configuration.File.Extensions --version 2.0.0
dotnet add package Microsoft.Extensions.Configuration.Json --version 2.0.0
dotnet add package System.Text.Encoding.CodePages --version 4.4.0
To restore the depencies and tools of a project by .NET Core Command-line interface, use #dotnet restore.
Applications that are written in C# can be compiled and linked by using the dotnet build.
To run the application, use #dotnet run.
For more information on the msbuild command line tools, see the Microsoft documentation.
Migrating existing .NET Framework-based applications to .NET Core
CICS TG .NET Core supports all classes, which are supported by .NET Framework CICS TG APIs. If application uses any .NET Framework-specific feature, which is not supported by .NET Core, then application code should be changed to rectify it.