[BUG][csharp-netcore] Setting netCoreProjectFile doesn't work
Created by: 414004738
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
What's the version of OpenAPI Generator used? -
Have you search for related issues/PRs? -
What's the actual output vs expected output? -
[Optional] Bounty to sponsor the fix (example)
Description
The documentation when running the command openapi-generator config-help -g csharp-netcore
lists a setting called netCoreProjectFile. However, when generating a client using the csharp-netcore generator with a targetFramework of netstandard2.0, the generated code seems to generate an "old-style" project that uses a project.json file instead of the newer csproj format, regardless of whether netCoreProjectFile is set to true or false.
If a targetFramework of netcoreapp2.0 is used, there is no project.json file generated and the csproj is the "newer" style, regardless of whether netCoreProjectFile is set to true or false.
The expected behaviour is that it should be possible to generate a project using the "newer" format for .NET project files (csproj with no project.json) even if the targetFramework is netstandard2.0.
I'm not sure if the netCoreProjectFile is even needed. I would at least expect using the new format for .NET project files would be the default behavior (regardless of whether targetFramework was netcoreapp2.0 or netstandard2.0).
openapi-generator version
4.1.0
OpenAPI declaration file content or url
I used the test yaml here: https://github.com/OpenAPITools/openapi-generator/blob/v4.1.0/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml
Command line used for generation
openapi-generator generate -g csharp-netcore -i ./petstore-with-fake-endpoints-models-for-testing.yaml --additional-properties targetFramework=netcoreapp2.0,netCoreProjectFile=true -o ./netcoreapp2.0
openapi-generator generate -g csharp-netcore -i ./petstore-with-fake-endpoints-models-for-testing.yaml --additional-properties targetFramework=netstandard2.0,netCoreProjectFile=true -o ./netstandard2.0
Steps to reproduce
Run the two commands above and compare the generated output. The output when targeting .netstandard2.0 includes a project.json file and the csproj differs quite a bit. I would expect the output of these 2 to be quite similar apart from <TargetFramework>netcoreapp2.0</TargetFramework>
in one case and <TargetFramework>netstandard2.0</TargetFramework>
in the other.
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/issues/3584