Reputation: 153
I am migrating WebApi2 project to MVC6. As we have other dependencies written in .NET 4.6.1 we need to target same version.
"frameworks": {
"net461": {}}
I have added dependencies:
"Swashbuckle": "5.3.2",
But the problem is that there is no way to hook up/register it to the ASP.NET Core MVC.
Is there any way to do it?
Upvotes: 0
Views: 4463
Reputation: 79
The Swashbuckle version that is compatible with .Net Framework 4.6. is 5.6.0
Upvotes: 0
Reputation: 49789
With ASP.NET Core you should use the this port of Swashbuckle https://github.com/domaindrivendev/Ahoy
Than you will Add/Use extensions methods:
public void ConfigureServices(IServiceCollection services)
{
... Configure MVC services ...
// Inject an implementation of ISwaggerProvider with defaulted settings applied
services.AddSwaggerGen();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
... Enable MVC middleware ...
// Enable middleware to serve generated Swagger as a JSON endpoint
app.UseSwagger();
// Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.)
app.UseSwaggerUi();
}
Upvotes: 5
Reputation: 64229
The 5.x version of Swashbuckle do not support ASP.NET Core MVC. You have to use the new Swashbuckle 6.x version which has support for ASP.NET Core.
The only version which supports ASP.NET Core 1.0 RTM is 6.0.0-beta901
.
So you need to add this to your project.json file
"Swashbuckle": "6.0.0-beta901"
Upvotes: 2