.NET Core 2 and SwashBuckle Swagger UI is not Displaying
Try deleting .vs
folder. Fixed it for me after upgrading to ASP.NET Core 2.1
After downloading and testing your code, it appears you must add the following NuGet package to your project:
Microsoft.AspNetCore.StaticFiles
You can do this through the NuGet Manager or by adding the following line to your .csproj <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0" />
Source: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/438
What did the trick for me:
- Delete all old files from your deployment folder (I tried with
IIS
, also works for other hosting types) - Replace all
Microsoft.AspNetCore.*
packages withMicrosoft.AspNetCore.All
meta package - see this post for the details. - [optional] Just case of the side effects, reinstall
Swashbuckle.AspNetCore
package (no otherSwashbuckle.AspNetCore.*
packages needed) Make sure you have these 2 packages in the project file (it is enough to make it working):
PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0"
PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0"
Publish (or deploy by copying the files) to your deployment folder. Now it should work.
NOTE: sometimes it fails (in this case it shows some unclear error in the browser) if you have duplicating model names in your API ;)