Not able to Inject Javascript in Swagger

I spent a lot of time trying to figure out that a method with the same name has a different behavior. The config in Startup.Configure expects a relative path from wwwroot:

public void Configure(IApplicationBuilder app) {
    //
    app.UseSwagger();
    app.UseSwaggerUI(c => {
        c.SwaggerEndpoint("/swagger/v1/swagger.json", "Salon API v1");
        c.InjectJavascript("/SwaggerExtension.js");
    });
}

Get started with Swashbuckle and ASP.NET Core


When using custom resources the resource name should contain the default namespace of your project as described here. In your case the configuration should be:

c.InjectJavaScript(thisAssembly, "AcctMgmt.SwaggerExtensions.inject.js")