.NetCobol invoking C# - COBCH0845

I have a solution in VS named AllManaged.

It consists of 2 projects: CobolPrograms and CSharpPrograms.  (The VS book says that a project should not contain a mixture of languages.)

CobolPrograms contains 2 programs/classes: CobolMain and CobolSub.  Both are managed code.

CSharpPrograms contains 1 program/class: CSharpSub.  The NameSpace is CSharpPrograms.

All programs display their program name and “Hello World”.

CobolMain invokes CobolSub and CSharpSub.

 

When I compile the solution, I get error COBCH0845 in CobolMain saying “Unknown class ‘CSharpSub’”.

I have unsuccessfully tried the following:

. In CobolMain, I put in the ILUSING “CSharpPrograms” compiler directive.

. For Project CobolPrograms, I have added CSharpPrograms to the NameSpace Property.

. For Project CobolPrograms, I have added “C:\...\visual studio 2010\Projects\AllManaged\CSharpPrograms” to the Reference Paths Property.

 

  • You should only need to add a project reference for the C# project to the References folder of the COBOL project in Solution Explorer.

    Right-click on References under the COBOL Project and select Add Reference.

    Under the Projects tab select your C# project.

    This should take care of it.