Created On: 16 September 2010
Problem:
Visual COBOL documentation covers the use of the cobol.exe command to compile native code unmanaged programs but it does not cover .NET managed code programs.
How does one compile and generate a .NET managed code assembly from COBOL source code from the command line outside of Visual Studio?
How does one compile and generate a .NET managed code assembly from COBOL source code from the command line outside of Visual Studio?
Resolution:
Although the Visual Studio IDE is the recommended method of compiling and building managed code assemblies the cobol.exe utility can be used to compile COBOL source and generate managed code assemblies as well as native code objects from a Visual COBOL command prompt.
To do this you use the -ilgen or -ilgen(sub) directives with the cobol command.
See the documentation in the section under General Reference > Compiler Directives > .NET COBOL command line compiler directives for a complete list of the directives that can be used to create managed code assemblies.
You can use this from a Visual COBOL command prompt which is available under Visual COBOL 2010->Tools.
Example:
cobol test.cbl,,,-ilgen
To do this you use the -ilgen or -ilgen(sub) directives with the cobol command.
See the documentation in the section under General Reference > Compiler Directives > .NET COBOL command line compiler directives for a complete list of the directives that can be used to create managed code assemblies.
You can use this from a Visual COBOL command prompt which is available under Visual COBOL 2010->Tools.
Example:
cobol test.cbl,,,-ilgen
Incident #2476200
Old KB# 31723