Skip to content

Remove need for users to special-case second and later clients #4916

Closed
@dougbu

Description

@dougbu

Is this a Bug or Feature request?

Enhancement that's part of #4896

Steps to reproduce (preferably a link to a GitHub repo with a repro project)

See https://github.com/dougbu/CodeGeneration repo and its ClientConsole project. Lines of particular interest are https://github.com/dougbu/CodeGeneration/blob/fbc0e82aa186f4d8de2ba7ece21f87d550be1817/ClientConsole/ClientConsole.csproj#L23-L26

Description of the problem

NSwag code generation creates Exception classes by default. Unfortunately, these classes are not nested and do not have unique names. So, when multiple generated clients are included in a project, compilation errors ensue.

This is not mandatory for the Preview3 milestone because multiple generated clients per project is a grow-up scenario and users can provide the necessary %(NSwagCSharpCodeGeneratorOptions) metadata to avoid problems.

Most likely fix is to update the GetProjectReferenceMetadata task to add FirstForGenerator metadata to the relevant items.

Version of Microsoft.AspNetCore.Mvc or Microsoft.AspNetCore.App or Microsoft.AspNetCore.All

See the features/client.code.generation branch branch. That work is intended for the 2.2 Preview 3 milestone.

Metadata

Metadata

Assignees

Labels

DoneThis issue has been fixedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions