Open capslocky opened 5 years ago
The nswag npm package does not contain this dll, because it contains the asp middleware and the package only the cli
The file is needed for aspnetcore2swagger
. And if we compare entire NSwag.* file set between npm and zip archive, that would be the only difference. Could you kindly add that file into future versions of npm package, so they would match?
Should not be needed for aspnetcore2swagger... why is that? Can you provide console logs, etc.?
.\node_modules\.bin\nswag aspnetcore2swagger /runtime:NetCore22 /documentName:v1 /output:MySwagger.json /assembly:D:\SomeAssembly.dll
NSwag NPM CLI
NSwag command line tool for .NET Core NetCore22, toolchain v12.3.1.0 (NJsonSchema v9.14.1.0 (Newtonsoft.Json v11.0.0.0))
Visit http://NSwag.org for more information.
NSwag bin directory: D:\SomeProject\ClientApp\node_modules\nswag\bin\binaries\NetCore22
System.IO.FileNotFoundException: Could not load file or assembly 'NSwag.AspNetCore, Version=12.3.1.0, Culture=neutral, PublicKeyToken=c2d88086e098d109'. The system cannot find the file specified.
File name: 'NSwag.AspNetCore, Version=12.3.1.0, Culture=neutral, PublicKeyToken=c2d88086e098d109' ---> System.IO.FileNotFoundException: Could not load the specified file.
File name: 'NSwag.AspNetCore'
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at CalorieCalc.ApiControllers.Startup.ConfigureServices(IServiceCollection services)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at NSwag.Commands.SwaggerGeneration.SwaggerGeneratorCommandBase`1.CreateWebHostAsync(AssemblyLoader assemblyLoader) in C:\projects\nswag\src\NSwag.Commands\Commands\SwaggerGeneration\SwaggerGeneratorCommandBase.cs:line 302
at NSwag.Commands.SwaggerGeneration.AspNetCore.AspNetCoreToSwaggerCommand.RunIsolatedAsync(AssemblyLoader assemblyLoader) in C:\projects\nswag\src\NSwag.Commands\Commands\SwaggerGeneration\AspNetCore\AspNetCoreToSwaggerCommand.cs:line 289
at NSwag.Commands.IsolatedCommandBase`1.IsolatedCommandAssemblyLoader`1.Run(String commandType, String commandData, String[] assemblyPaths, String[] referencePaths) in C:\projects\nswag\src\NSwag.Commands\Commands\IsolatedCommandBase.cs:line 70
at NSwag.Commands.IsolatedCommandBase`1.<>c__DisplayClass17_0.<RunIsolatedAsync>b__0() in C:\projects\nswag\src\NSwag.Commands\Commands\IsolatedCommandBase.cs:line 60
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
--- End of stack trace from previous location where exception was thrown ---
at NSwag.Commands.IsolatedCommandBase`1.RunIsolatedAsync(String configurationFile)
at NSwag.Commands.IsolatedSwaggerOutputCommandBase`1.RunAsync(CommandLineProcessor processor, IConsoleHost host) in C:\projects\nswag\src\NSwag.Commands\Commands\IsolatedSwaggerOutputCommandBase.cs:line 47
at NSwag.Commands.SwaggerGeneration.AspNetCore.AspNetCoreToSwaggerCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in C:\projects\nswag\src\NSwag.Commands\Commands\SwaggerGeneration\AspNetCore\AspNetCoreToSwaggerCommand.cs:line 88
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 54
NSwag.AspNetCore v12.3.1 is installed in your web project?
Yes, but newer version: NSwag.AspNetCore v13.0.0-20190531.9
Yeah, v13 preview cannot be used with the CLI yet...
But npm cli tools shouldn't rely on project packages, right?
But npm cli tools shouldn't rely on project packages, right?
It's not that easy because the original idea was that the CLI version "wins" and thus it is part of it...
Maybe you could try to use the project parameter instead, but there are quite some breaking changes in v13 and I'd expect that this wont work:
.\node_modules.bin\nswag aspnetcore2swagger /runtime:NetCore22 /documentName:v1 /output:MySwagger.json /project:D:\SomeProject.csproj
Tried, but encountered some compilation issues. Actually my project uses asp.net core 3.0 (preview). But I have targeted api controller assembly both .net core 2.2 and 3.0 just in order to generate client with your great tool.
It's not a problem at all, as I use workaround with storing NSwag.AspNetCore.dll
in repo and copying it into \node_modules
. It still seems strange that npm cli lacks that file vs zip cli.
You may close this issue. Thanks for support!
I'm using NSwag cli via npm package with latest version 12.3.1. Seems like it missing file
NSwag.AspNetCore.dll
, I had to copy it into\node_modules\nswag\bin\binaries\NetCore22
from another source. Should it present there?