title: Adding Swagger to ASP.Net Core Web API
body: <p>I am trying to add Swagger to my ASP.Net Core Web API project, like this:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
         services.AddControllers();
         services.AddSwaggerGen(c =&gt;
         {
            c.SwaggerDoc("v0.1", new OpenApiInfo { Title = "My API", Version = "v0.1" });
         });
  }
  
  public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
          {
              ...
              app.UseHttpsRedirection();
  
              app.UseSwagger();
              app.UseSwaggerUI(c =&gt;
              {
                  c.SwaggerEndpoint("/swagger/v0.1/swagger.json", "My API V1");
              });
  
              app.UseRouting();
  
              app.UseAuthorization();
              ...
  }
  </code></pre>
  
  <p>but I am getting this error:</p>
  
  <blockquote>
    <p>The type or namespace name 'OpenApiInfo' could not be found</p>
  </blockquote>
  
  <p>I have installed Swashbuckle.AspNetCore v4.0.1, and my project is .Net Core 3.0.</p>