Open dylanvdmerwe opened 11 months ago
As mentioned in log, cmd is using Net70
instead of Net80
I think, #4680 should resolve this issue
@krzyhan Yes that looks to be the issue. Well found, I was hunting but came up with nothing.
Let's hope this can get published soonest.
I'm still getting this issue with 14.0.1 when calling openapi2tsclient /runtime:Net80 /input:....OpenAPI.json
NSwag command line tool for .NET Core Net80, toolchain v14.0.1.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0))
NSwag bin directory: /blabla/node_modules/nswag/bin/binaries/Net80
NConsole.UnusedArgumentException: Unrecognised arguments are present: [/runtime:Net80]
@ptasev I have the same error. After i removed /runtime:Net80
the command completes succesfully!
This did not work in 14.0.0, but seems to fix it in 14.0.1
Same here but had to remove the /runtime:Net60
argument in the nswag command nswag run client.nswag
using version 14.0.1
Seems like the runtime argument in the cli is not used anymore?
NConsole.UnusedArgumentException: Unrecognised arguments are present: [/runtime:Net60]
I'm really confused if we really are no longer supposed to be using this, or if it's a bug. I see there's runtime here but it's defaulted to Net60: https://github.com/RicoSuter/NSwag/blob/313ea53f4f8a53c0e66b0f84f63f3224bfcebcac/src/NSwag.Commands/NSwagDocumentBase.cs#L60
Also, nswag npm.js seems to accept the runtime argument, considering that it converts legacy args to using runtime, so I'm not sure what to think: https://github.com/RicoSuter/NSwag/blob/313ea53f4f8a53c0e66b0f84f63f3224bfcebcac/src/NSwag.Npm/bin/nswag.js#L17
nswag run /runtime:Net80
Ensure that the project has been built.
at NSwag.Commands.Generation.AspNetCore.AspNetCoreToOpenApiCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in /_/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs:line 82
at NSwag.Commands.NSwagDocumentBase.GenerateSwaggerDocumentAsync() in /_/src/NSwag.Commands/NSwagDocumentBase.cs:line 270
at NSwag.Commands.NSwagDocument.ExecuteAsync() in /_/src/NSwag.Commands/NSwagDocument.cs:line 67
at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in /_/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 76
at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in /_/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 40
at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input)
at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input)
at NSwag.Commands.NSwagCommandProcessor.ProcessAsync(String[] args) in /_/src/NSwag.Commands/NSwagCommandProcessor.cs:line 62
any idea about this error please!
I'm still getting this issue with 14.0.1 when calling
openapi2tsclient /runtime:Net80 /input:....OpenAPI.json
NSwag command line tool for .NET Core Net80, toolchain v14.0.1.0 (NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0)) NSwag bin directory: /blabla/node_modules/nswag/bin/binaries/Net80 NConsole.UnusedArgumentException: Unrecognised arguments are present: [/runtime:Net80]
remove /runtime:Net80
Same here but had to remove the
/runtime:Net60
argument in the nswag commandnswag run client.nswag
using version 14.0.1Seems like the runtime argument in the cli is not used anymore?
NConsole.UnusedArgumentException: Unrecognised arguments are present: [/runtime:Net60]
for run
command runtime
is supported but only for default config files (so it will take default nswag.json
or *.nswag
files)
nswag run /runtime:Net80
Ensure that the project has been built. at NSwag.Commands.Generation.AspNetCore.AspNetCoreToOpenApiCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in /_/src/NSwag.Commands/Commands/Generation/AspNetCore/AspNetCoreToOpenApiCommand.cs:line 82 at NSwag.Commands.NSwagDocumentBase.GenerateSwaggerDocumentAsync() in /_/src/NSwag.Commands/NSwagDocumentBase.cs:line 270 at NSwag.Commands.NSwagDocument.ExecuteAsync() in /_/src/NSwag.Commands/NSwagDocument.cs:line 67 at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in /_/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 76 at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in /_/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 40 at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input) at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input) at NSwag.Commands.NSwagCommandProcessor.ProcessAsync(String[] args) in /_/src/NSwag.Commands/NSwagCommandProcessor.cs:line 62
any idea about this error please!
do you have documentGenerator.aspNetCoreToOpenApi.noBuild
set to false
?
seems like project has not been built yet
Still an issue in 14.0.8. Running from the command line without /runtime:Net80 tells you to add it. Running with it tells you to remove it.
nswag run file.nswag.json
NSwag command line tool for .NET 4.6.2+ WinX64, toolchain v14.0.8.0 (NJsonSchema v11.0.1.0 (Newtonsoft.Json v13.0.0.0))
Visit http://nswag.org/ for more information.
NSwag bin directory: C:\Program Files (x86)\Rico Suter\NSwagStudio\Win
Executing file 'enviApi.nswag.json' with variables ''...
System.InvalidOperationException: The specified runtime in the document (Net80) differs from the current process runtime (WinX64). Change the runtime with the '/runtime:Net80' parameter or run the file with the correct command line binary.
at NSwag.Commands.Document.ExecuteDocumentCommand.
d__9.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NSwag.Commands.Document.ExecuteDocumentCommand.
d__8.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NConsole.CommandLineProcessor.
d__12.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at NConsole.CommandLineProcessor.
d__11.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at NSwag.Commands.NSwagCommandProcessor.
d__3.MoveNext()
nswag run file.nswag.json /runtime:Net80
NSwag command line tool for .NET Core Net80, toolchain v14.0.8.0 (NJsonSchema v11.0.1.0 (Newtonsoft.Json v13.0.0.0))
Visit http://nswag.org/ for more information.
NSwag bin directory: C:\Program Files (x86)\Rico Suter\NSwagStudio\Net80
NConsole.UnusedArgumentException: Unrecognised arguments are present: [/runtime:Net80]
at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input)
at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input)
at NSwag.Commands.NSwagCommandProcessor.ProcessAsync(String[] args) in _/src/NSwag.Commands/NSwagCommandProcessor.cs:line 65
Renaming the file to file.nswag and then running this does work:
nswag run /runtime:Net80
Removing passed runtime argument in nswag.cmd works for me.
@ECHO OFF
set args=%*
IF NOT "%args:/runtime:winx86=%" == "%args%" (
"%~dp0/Win/nswag.x86.exe" %*
GOTO end
)
IF NOT "%args:/runtime:net60=%" == "%args%" (
dotnet "%~dp0/Net60/dotnet-nswag.dll" %*
GOTO end
)
IF NOT "%args:/runtime:net70=%" == "%args%" (
- dotnet "%~dp0/Net70/dotnet-nswag.dll" %*
+ dotnet "%~dp0/Net70/dotnet-nswag.dll" %args:/runtime:net70=%
GOTO end
)
IF NOT "%args:/runtime:net80=%" == "%args%" (
dotnet "%~dp0/Net80/dotnet-nswag.dll" %*
GOTO end
)
"%~dp0/Win/nswag.exe" %*
:end
Still an issue in 14.1 Running from the command line without /runtime:Net60 tells you to add it. Running with it tells you to remove it. Any suggestions as to how I can run it for a .NET 6.0 project.
With /runtime:Net60
NSwag NPM CLI NSwag command line tool for .NET Core Net60, toolchain v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0)) Visit http://NSwag.org for more information. NSwag bin directory: C:\Git\custom-elements\node_modules\nswag\bin\binaries\Net60 NConsole.UnusedArgumentException: Unrecognised arguments are present: [/runtime:Net60] at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input) at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input) at NSwag.Commands.NSwagCommandProcessor.ProcessAsync(String[] args) in /_/src/NSwag.Commands/NSwagCommandProcessor.cs:line 65node:child_process:965 throw err; ^
Without /runtime:Net60
System.InvalidOperationException: The specified runtime in the document (Net60) differs from the current process runtime (Net80). Change the runtime with the '/runtime:Net60' parameter or run the file with the correct command line binary. at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in /_/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 69 at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in /_/src/NSwag.Commands/Commands/Document/ExecuteDocumentCommand.cs:line 33 at NConsole.CommandLineProcessor.ProcessSingleAsync(String[] args, Object input) at NConsole.CommandLineProcessor.ProcessAsync(String[] args, Object input) at NSwag.Commands.NSwagCommandProcessor.ProcessAsync(String[] args) in /_/src/NSwag.Commands/NSwagCommandProcessor.cs:line 65node:child_process:965
I presume your nswag json file specifies the runtime as .NET 6 despite the assembly being .NET 8. You'll have to change the settings.
Seeing the same here :
System.InvalidOperationException: The specified runtime in the document (Net80) differs from the current process runtime (WinX64). Change the runtime with the '/runtime:Net80' parameter or run the file with the correct command line binary.
at NSwag.Commands.Document.ExecuteDocumentCommand.
"runtime": "Net80" specified in the nswag file
I agree with Tridus. Omitting the file name works. Definitely seems like a bug.
Runtime specified in nswag.json as "Net80".
Not quite sure if it's needed in both places, but did it to make sure.
Then run the Nswag CLI tool (npm i -g nswag@14) run command:
Alright then let's set the /runtime parameter with the CLI:
The correct runtime is specified in the config file.
It seems like there is an issue with the CLI. Please advise how to get this working as after updating to net80 we cannot use nswag via the CLI to generate Typescript.