nswag run version not working throwing "FileNotFoundException"
See original GitHub issueThe command
nswag run version /runtime:NetCore22
produces the following output:
NSwag NPM CLI
NSwag command line tool for .NET Core NetCore21, toolchain v13.1.3.0 (NJsonSchema v10.0.27.0 (Newtonsoft.Json v11.0.0.0))
Visit http://NSwag.org for more information.
NSwag bin directory: C:\Users\user\AppData\Roaming\npm\node_modules\nswag\bin\binaries\NetCore21
Executing file 'version' with variables ''...
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not find file 'C:\projects\cp\Abus\Notifications\notifications-api\ABUS.Cloud.Notifications.Adapters\MailTemplate\Proxy\vers
ion'.
at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks)
at System.IO.File.InternalReadAllText(String path, Encoding encoding)
at System.IO.File.ReadAllText(String path, Encoding encoding)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at NJsonSchema.Infrastructure.DynamicApis.FileReadAllText(String filePath)
at NSwag.Commands.NSwagDocumentBase.<>c__DisplayClass35_0`1.<<LoadAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at NSwag.Commands.NSwagDocument.LoadWithTransformationsAsync(String filePath, String variables) in C:\projects\nswag\src\NSwag.Commands\NSwagDocument.cs:line 69
at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in C:\projects\nswag\src\NSwag.Commands\Commands\Document\ExecuteDocumentCommand.cs:line 63
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 56child_process.js:644
throw err;
^
Error: Command failed: dotnet "C:\Users\benjamin.moll\AppData\Roaming\npm\node_modules\nswag\bin/binaries/NetCore21/dotnet-nswag.dll" run version /runtime:NetCore21
at checkExecSyncError (child_process.js:601:13)
at Object.execSync (child_process.js:641:13)
at c.exec (C:\Users\benjamin.moll\AppData\Roaming\npm\node_modules\nswag\bin\nswag.js:56:19)
at ChildProcess.exithandler (child_process.js:267:7)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Socket.stream.socket.on (internal/child_process.js:346:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
Tried it on Win10 natively and also within a docker container using the base image mcr.microsoft.com/dotnet/core/sdk:2.2
Weirdest part is that when I do
nswag version /runtime:NetCore22
it seems to work fine but here it clearly states to use run as argument as well…
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
asp.net core - Why do NSwag fail on my computer and not ...
I'm working on a large C# Asp.NetCore 3.1 project where we uses Nswag to generate swagger.json and a C# ProxyClient for our API....
Read more >System.IO.FileNotFoundException: 'Could not load file or ...
I have an application in .net core. the application was running fine, but the error started coming after I installed.
Read more >nswag error in .NET Core 3.1 #8719
Hi,. I am using .NET Core 3.1 & Angular 8. I am facing an issue when running refresh.bat. It's throwing me below mentioned...
Read more >Untitled
Msb3073 the command dotnet swagger tofile Error running `dotnet swagger` if the input dll was compiled as x86 ... Splet12. okt.
Read more >[Solved]-Asp.net Font File .otf file not found exception ...
Try this: Add the font like a resources, then PrivateFontCollection privateFontCollection = new PrivateFontCollection(); var memory = IntPtr.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I know, the command nswag run version /runtime:NetCore22 is taken from here
Update npm readme