Skip to content

[BUG][csharp-netcore] Unexpected ItemGroup with references in csproj file #3687

@douggish

Description

@douggish

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

When generating a client using the csharp-netcore generator with a targetFramework of netcoreapp2.0, there is an unexpected ItemGroup in the generated csproj file:

  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="System.ComponentModel.DataAnnotations" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.Xml" />
  </ItemGroup>

It doesn't seem like the references in this ItemGroup are necessary, and seem to be generating a warning on compilation:

Microsoft.Common.CurrentVersion.targets(2110, 5): [MSB3245] Could not resolve this reference. Could not locate the assembly "System.Data.DataSetExtensions". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

If this entire ItemGroup is removed, the code compiles successfully and this warning is not generated.

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 -o ./netcoreapp2.0

Steps to reproduce

Run the command line above and look at the generated Org.OpenAPITools.csproj file. Build the project to see the compilation warning.

Related issues/PRs
Suggest a fix

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions