0

When you run this code
java -jar swagger-codegen-cli-3.0.35.jar generate -i openapi.json -l csharp -o test in command prompt, it creates a solution and also a project named IO.Swagger.

It is possible to change the name of the project and its namespace path?

When I changed the name of the project, it does not change the namespace path based on the project name.

It is a lot of files that need to be changed and it takes forever!

Thank you!

HelloWorld1
  • 13,688
  • 28
  • 82
  • 145
  • You control the namespace of an already created project by going to the Project's Properties in Visual Studio. To open the Properties view, Right click on the project in the _Solution Explorer_ and select _Properties_ from the context menu. Under the _Application_ tab, the properties you care about are, 'Assembly Name' and 'Default Namespace'. – quaabaam Sep 02 '22 at 16:50
  • I tried and it does not give any effect – HelloWorld1 Sep 02 '22 at 17:00
  • You will still have to change the namespace for any classes that existed before the change, but anything added after will use the updated namespace. – quaabaam Sep 02 '22 at 18:42

1 Answers1

0

"you could also use the option directly: -DpackageName=My.Namespace.Whatever"

Swagger-Codegen custom settings

HelloWorld1
  • 13,688
  • 28
  • 82
  • 145
  • Hi HelloWorld1, glad to know you've found the solution to resolve this issue! Please consider accepting it as an answer to change its status to Answered. See [can I answer my own question..](https://stackoverflow.com/help/self-answer), Just a reminder :) – Jiale Xue - MSFT Sep 06 '22 at 09:41