Swashbuckle.aspnetcore: Failed with ASP.NET Core 2.0 app targeting full .NET

Created on 15 Sep 2017  路  8Comments  路  Source: domaindrivendev/Swashbuckle.AspNetCore

Adding Swashbuckle.AspNetCore to ASP.NET Core 2.0 API App (default template).
But when I trying to open swagger UI I got

MissingMethodException: Method not found: 'Void Microsoft.Net.Http.Headers.EntityTagHeaderValue..ctor(System.String)'.
Microsoft.AspNetCore.StaticFiles.StaticFileContext.LookupFileInfo()
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.StaticFiles.DefaultFilesMiddleware.Invoke(HttpContext context)
Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware+d__6.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Builder.RouterMiddleware+d__4.MoveNext()
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware+d__7.MoveNext()

PS: With .NET Core app all works well.

Most helpful comment

Is this not the same as #438?

If it is, the solution for me was to install the _Microsoft.AspNetCore.StaticFiles_ Nuget package suggested by Aetherix.

All 8 comments

Is this not the same as #438?

If it is, the solution for me was to install the _Microsoft.AspNetCore.StaticFiles_ Nuget package suggested by Aetherix.

Yes. Looks like that.

Thanks @Chris-ZA

PM> Install-Package Microsoft.AspNetCore.StaticFiles

Solved the issue for me...

Hmmm ... this workaround is a poor dev experience. Ideas for addressing this are welcome

I'm still struggling with this issue, any other ideas? Thanks.

Microsoft.AspNetCore.StaticFiles solved it for me.

To those still struggling. If you still have this error after installing Microsoft.AspNetCore.StaticFiles, check the version of the nuget package for compatibility with the ASP.NET Core version that you're building.

Was this page helpful?
0 / 5 - 0 ratings