Search code examples
c#.net-coreswaggernswagnswagstudio

nswag command line generating proxy file not found


I have used NSwagStudio to generate client proxy in c#. I saved the project into an .nswag file. I have added it to my .net core console app. I then use the following command in package manager console nswag.cmd run .\client.nswag /runtime:NetCore31

I get

NSwag command line tool for .NET Core NetCore31, toolchain v13.7.4.0 (NJsonSchema v10.1.26.0 (Newtonsoft.Json v12.0.0.0))
Visit http://NSwag.org for more information.
NSwag bin directory: C:\Users\mypc\AppData\Roaming\npm\node_modules\nswag\bin\binaries\NetCore31

Executing file '.\client.nswag' with variables ''...
Done.

But I dont see the output file created. Where is this file saved?


Solution

  • You need to define the output file by either:

    • Giving a value to output variable in nswag.json: "output": "<your_path>/client.cs"
    • Passing it as a parameter to your cli* invocation: nswag.cmd run .\client.nswag /runtime:NetCore31 /output:<your_path>/client.cs

    * The same applies to NSwag.MSBuild, in case you ever go down that path:

    $(NSwagExe_Core31) run .\client.nswag /runtime:NetCore31 /output:<your_path>/client.cs