AspNetCoreToSwaggerGenerator and TestServer (CLI): Cannot resolve IApiDescriptionGroupCollectionProvider (.NET Core 2.0)
See original GitHub issueWhen executing the new AspNetCoreToSwaggerGenerator against a .NET Core 2.0 via CLI and TestServer, it cannot resolve IApiDescriptionGroupCollectionProvider:
But examining the services object, it clearly has a IApiDescriptionGroupCollectionProvider registration, even with the correct type ($1):
Also this works for the .NET Core 2.1 sample project.
Steps to reproduce:
- Open NSwag.sln
- Select NSwag.ConsoleCore as startup project and select 2.0:
- In project debug settings, use the command line args:
run "MyPath\NSwag\samples\WithoutMiddleware\Sample.AspNetCore20\nswag_assembly.nswag"
- Run project with all exceptions enabled (break on all exceptions)
The same works for MyPath\NSwag\samples\WithoutMiddleware\Sample.AspNetCore21\nswag_assembly.nswag
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
No service for type 'Microsoft.AspNetCore.Mvc.ApiExplorer. ...
I can't seem to get swashbuckle to work for my .net core project. "Swashbuckle. ... IApiDescriptionGroupCollectionProvider' has been registered. #299.
Read more >c# - Cannot resolve parameter 'Microsoft.AspNetCore.Mvc. ...
SwaggerGenerator' can be invoked with the available services and parameters: Cannot resolve parameter 'Microsoft.AspNetCore.Mvc.ApiExplorer.
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 >
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
Found that it is the same issue solved here.
When using
services.AddMvcCore()
instead ofservices.AddMvC()
inStartup.cs:ConfigureServices()
, you must do:Nice find, @Ghostbird!
For Google’s sake, if you get
on startup, the solution is to add
in
public void ConfigureServices(IServiceCollection services)