Skip to content

c# asp.net 4.* server generation support #9355

@oleksabor

Description

@oleksabor
Description

I'd like to get Models and Controllers to be generated for Asp.Net 4.* framework. Unfortunately current Asp.net Core generator produces incompatible code, like namespaces and types that exists in the .Net Core framework only.

There is a need to implement REST service for the legacy .Net 4.7.2 project and client is using .Net Core 2 framework. So I'd like to use the same yaml to generate client and server from the one source

Models source code can be compiled for .Net Framework 4 as is but not Controllers.

I've tried to modify generated controllers source code to be compiled using .Net Core and .Net Framework but failed. I can't get deal with Core specific type usage, like IActionResult and Swashbuckle.AspNetCore.SwaggerGen namespace even using #if NETCOREAPP2_0 .

Swagger-codegen version

2.4.5

Related issues/PRs

#7114

Suggest a fix/enhancement

I'm going to add AspNet4ServerGenerator class and copy mustache templates. Hope server source code will be compiled using .Net 4.7.2
Not sure that will be able to implement Swashbuckle metadata descriptions to provide web interface description.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions