Highlighted
Absent Member.
Absent Member.
836 views

use a c sharp class in visual cobol

Jump to solution

I have a main c# application that runs visual cobol programs. both project have different namespaces. In my c sharp project I have a logger class that I would like both projects to use.

So far I've made a reference to the main project from the cobol project, used $set ilusing"namespace" added the namespace to the cobol project through the GUI. Nothing. I think I might be missing a bigger issue. Any ideas?

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: use a c sharp class in visual cobol

Jump to solution

I think the problem may be that you are adding a reference to a main project (.exe) and not to a class library (.dll). An .exe cannot be loaded.

If you need to reference the logger class from both the C# main and the called COBOL Class library you should probably place the common logger class into a project by itself and then reference this from both C# and the COBOL projects.

View solution in original post

0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: use a c sharp class in visual cobol

Jump to solution

the error is COBCH0845 can't find the namespace....

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: use a c sharp class in visual cobol

Jump to solution

I think the problem may be that you are adding a reference to a main project (.exe) and not to a class library (.dll). An .exe cannot be loaded.

If you need to reference the logger class from both the C# main and the called COBOL Class library you should probably place the common logger class into a project by itself and then reference this from both C# and the COBOL projects.

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: use a c sharp class in visual cobol

Jump to solution

that did it. Thanks Chris

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.