dotnet "C:\Users\admin.nuget\packages\nswag.msbuild\13.13.2\build../tools/Net50/dotnet-nswag.dll" aspnetcore2openapi /assembly:D:\Project\bin\Debug\net5.0\Project.dll /output:swagger.json
NSwag command line tool for .NET Core Net50, toolchain v13.13.2.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v12.0.0.0))
Visit http://NSwag.org for more information.
NSwag bin directory: C:\Users\admin.nuget\packages\nswag.msbuild\13.13.2\tools\Net50
Code has been successfully generated but not written to file (no change detected).
Duration: 00:00:01.9119636
dotnet "C:\Users\admin.nuget\packages\nswag.msbuild\13.13.2\build../tools/Net50/dotnet-nswag.dll" run swagger.json /variables:Configuration=Debug
NSwag command line tool for .NET Core Net50, toolchain v13.13.2.0 (NJsonSchema v10.5.2.0 (Newtonsoft.Json v12.0.0.0))
Visit http://NSwag.org for more information.
NSwag bin directory: C:\Users\admin.nuget\packages\nswag.msbuild\13.13.2\tools\Net50
Executing file 'swagger.json' with variables 'Configuration=Debug'...
System.InvalidOperationException: The specified runtime in the document (NetCore21) differs from the current process runtime (Net50). Change the runtime with the '/runtime:NetCore21' parameter or run the file with the correct command line binary.
at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in C:\projects\nswag\src\NSwag.Commands\Commands\Document\ExecuteDocumentCommand.cs:line 68
at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in C:\projects\nswag\src\NSwag.Commands\Commands\Document\ExecuteDocumentCommand.cs:line 32
at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input)
at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input)
at NConsole.CommandLineProcessor.Process(String[] args, Object input)
at NSwag.Commands.NSwagCommandProcessor.Process(String[] args) in C:\projects\nswag\src\NSwag.Commands\NSwagCommandProcessor.cs:line 55
D:\Project\Project.csproj(60,5): error MSB3073: The command "dotnet "C:\Users\admin.nuget\packages\nswag.msbuild\13.13.2\build../tools/Net50/dotnet-nswag.dll" run swagger.json /variables:Configuration=Debug" exited with code -1.
After 2hrs i found NSwagDocumentBase that default's Runtime property to Runtime.NetCore21.
Had to manually add a non-existent property runtime to my auto-generated swagger.json and comment the file generation task to get it to work.
Hi! Using
results in
After 2hrs i found NSwagDocumentBase that default's Runtime property to Runtime.NetCore21.
Had to manually add a non-existent property runtime to my auto-generated swagger.json and comment the file generation task to get it to work.
Edit: formatting.