Bug Report: Redundant Platform Target

I noticed a setting in the COBOL project settings that may clash with other projects in a Visual Studio solution when compiling for x64 processors:

Redundant platform target.png


Apparently, the Visual Studio 2019 MSBuild platform target (1) is ignored while at the same time a proprietary Platform Target property (2) has been added in project settings.

From what I can see so far ...

  1. the proprietary setting is pointless as it is ignored by the compiler
    (i.e. no compiler settings are changed when this value is changed (see Build Settings text field at the bottom of the COBOL settings page))
  2. no MSBuild platform target is available for x64 in the solution (1)
  3. The compiler appears to compile to the MSBuild platform target (3), ignoring the proprietary setting (2)

As a beginner to COBOL (particularly to Visual COBOL) I'm anything but sure and I'm not able to set-up a sample solution at this time; yet, adding a 64 bit .NET project to this solution and adding dependencies to the COBOL project should result in failure.

As a fix I would expect the proprietary setting (2) removed and the Visual Studio MSBUILD platform setting (1) utilized.

I may be wrong, though. Am I barking up the wrong tree here?

Your help is very much appreciated.


  • Verified Answer

    Hi BlackKnight,

    I think that you are confusing the configuration platform, which is ultimately just a name for a collection of build settings, with the Platform Type in the COBOL properties which indicates the type of executable to be created by the COBOL compiler. 

    So, what you have done with your x86 configuration and setting a platform type of x64 is perfectly valid but confusing to anybody looking at the project so what you would ideally do is create an x64 configuration which will build to a different location.

    As the name of the configurations can be whatever you want you could even have a BlackKnight configuration if you wanted to.


  • As Gael mentioned, the solution platform property is just a custom name for which all your projects have a specific configuration and platform combination associated with. The typical way you would add an x64 configuration is to click Configuration Manager under the platform dropdown at the top of the IDE and create a new solution platform. Specify x64 and copy settings from x86. VS will then automatically create a new x64 platform for each project and specify x64 as the platform target. You can change the platform target on each individual project if you wish, the IDE will not stop you. Perhaps you might want to call your solution platform "almost_x64" and have most, but not all projects target x64. This is just an example.

    As for your question about the build settings not updating when you change the platform target. This does indeed look like an issue. It should be toggling whether the P64 directive is added to the directives or not. This can be changed by actually editing the project file and setting the <Pointer64> XML element but ideally the platform target dropdown should change this. If you automatically create an x64 platform via the method above, it does set the Pointer64 property for you but there is no way of changing that from inside the IDE after that. So thanks for reporting that, we will look into improving it.

    It is also worth noting that the x64 COBOL compiler will be used instead of the x86 compiler when changing the platform target. You won't see this in the build settings box as that is a difference in what physical .exe file is called when compiling.

    .NET projects work a bit differently. For .NET you can change the platform target from the Advanced Options dialog and change the P64 directive independently. "Any CPU" is also another platform target that can be used which is another reason why you might have mismatched platforms of projects and the solution platform.




  • Oh my God, you're right Gael (and Ted). I accidentally mixed them up. Face palm‍ I got too acquainted to the Microsoft .NET presets and went blind. I feel embarrassed for my ignorance.

    Though, I was missing the -P64 option in the Build Settings text field when switching over to x64. Shouldn't changing the target platform be reflected in the compiler options text field at the bottom?

  • P64 is set by default when using the 64-bit version of cobol.exe by the executable itself rather than being passed as an option, the 64-bit version being used when building the x64 targets, and that is why you do not see it in the supplied options.

    Cross-compilation of executables is not supported so setting P64 in an x86 build would result in a build failure.

    I hope that makes sense !