services.AddSwaggerGen() giving error

I had problem, that

IServiceCollection does not contain a definition for ‘AddSwaggerGen’

I turnes out, that I installed Swashbuckle.AspNetCore.Swagger nuget package instead of Swashbuckle.AspNetCore.

In .NET Core 3, there’s some issues as discussed here. The solution is to add the following to the project file, replacing the prior version.

<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc2" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="5.0.0-rc2" />

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)