question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in asp.net core 2.1 project to swagger

See original GitHub issue

System.InvalidOperationException: Swagger generation failed with non-zero exit code ‘1’.

Runtime: NetCore21 at NSwag.Commands.SwaggerGeneration.AspNetCore.AspNetCoreToSwaggerCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in C:\projects\nswag\src\NSwag.Commands\Commands\SwaggerGeneration\AspNetCore\AspNetCoreToSwaggerCommand.cs:line 172 at NSwag.Commands.NSwagDocumentBase.GenerateSwaggerDocumentAsync() in C:\projects\nswag\src\NSwag.Commands\NSwagDocumentBase.cs:line 268 at NSwag.Commands.NSwagDocument.ExecuteAsync() in C:\projects\nswag\src\NSwag.Commands\NSwagDocument.cs:line 81 at NSwag.Commands.Document.ExecuteDocumentCommand.ExecuteDocumentAsync(IConsoleHost host, String filePath) in C:\projects\nswag\src\NSwag.Commands\Commands\Document\ExecuteDocumentCommand.cs:line 77 at NSwag.Commands.Document.ExecuteDocumentCommand.RunAsync(CommandLineProcessor processor, IConsoleHost host) in C:\projects\nswag\src\NSwag.Commands\Commands\Document\ExecuteDocumentCommand.cs:line 31 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

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Could not load file or assembly ‘NSwag.CodeGeneration, Version=11.17.15.0, Culture=neutral, PublicKeyToken=c2d88086e098d109’. The system cannot find the file specified. Could not load file or assembly ‘NSwag.CodeGeneration.CSharp, Version=11.17.15.0, Culture=neutral, PublicKeyToken=c2d88086e098d109’. The system cannot find the file specified. Could not load file or assembly ‘NSwag.CodeGeneration, Version=11.17.15.0, Culture=neutral, PublicKeyToken=c2d88086e098d109’. The system cannot find the file specified. Could not load file or assembly ‘NSwag.CodeGeneration.CSharp, Version=11.17.15.0, Culture=neutral, PublicKeyToken=c2d88086e098d109’. The system cannot find the file specified. Could not load file or assembly ‘NSwag.CodeGeneration.TypeScript, Version=11.17.15.0, Culture=neutral, PublicKeyToken=c2d88086e098d109’. The system cannot find the file specified. at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) at System.Reflection.RuntimeAssembly.get_DefinedTypes() at System.Linq.Enumerable.SelectManySingleSelectorIterator2.ToArray() at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at AutoMapper.ServiceCollectionExtensions.AddAutoMapperClasses(IServiceCollection services, Action1 additionalInitAction, IEnumerable1 assembliesToScan) at Mizekar.Micro.Idea.Startup.ConfigureServices(IServiceCollection services) in D:\Workspace\Mizekar.Micro.Idea\src\Mizekar.Micro.Idea\Startup.cs:line 46 — 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.AspNetCore.AspNetCoreToSwaggerGeneratorCommandEntryPoint.GetServiceProvider(String applicationName) in C:\projects\nswag\src\NSwag.Commands\Commands\SwaggerGeneration\AspNetCore\AspNetCoreToSwaggerGeneratorCommandEntryPoint.cs:line 64 at NSwag.Commands.SwaggerGeneration.AspNetCore.AspNetCoreToSwaggerGeneratorCommandEntryPoint.Process(String commandContent, String outputFile, String applicationName) in C:\projects\nswag\src\NSwag.Commands\Commands\SwaggerGeneration\AspNetCore\AspNetCoreToSwaggerGeneratorCommandEntryPoint.cs:line 21 — 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 NSwag.AspNetCore.Launcher.Program.Main(String[] args) in C:\projects\nswag\src\NSwag.AspNetCore.Launcher\Program.cs:line 125

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
RicoSutercommented, Jul 26, 2018

Please create a new issue to add this setting (default: nswag.json directory)

1reaction
RicoSutercommented, Jul 5, 2018

Good to know, but still bothers me that this is required…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swashbuckle/Swagger on .NET Core 2.1 has stopped ...
Project has a reference to Swashbuckle.AspNetCore version 2.5.0. The relevant code in Startup.cs is below. In ConfigureServices() : services.
Read more >
Get started with Swashbuckle and ASP.NET Core
Swashbuckle.AspNetCore.SwaggerGen: a Swagger generator that builds SwaggerDocument objects directly from your routes, controllers, and models.
Read more >
Configuring and Using Swagger UI in ASP.NET Core Web ...
We are going to learn how to integrate the Swagger UI/OpenAPI in an ASP.NET Core Web API, extend the documentation, and customize UI....
Read more >
Asp.Net Core API published. Default page getting 500 error ...
Open the F12 developer Console tool and click on the swagger.json link, and check the detail error message. Refer to this thread. Generally, ......
Read more >
Swashbuckle/Swagger on .NET Core 2.1 has stopped ...
I have a .NET Core 2.0 application, using Swashbuckle/Swagger to generate API documentation. When we were on 2.1.0-preview, Swagger was working fine.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found