简体   繁体   中英

Error installing Swashbuckle Nuget package on asp.net 5

I am trying to install SwashBuckle to an ASP.NET 5 Web API application.

The problem comes during installation where I get the following error:

在此处输入图片说明

This is due to the fact that the package is only partly compatible with DNX Core 5, specifically WebActivatorEx which is installed under DNX 4.5.1 and as such the SwashBuckle dll can't get at it as that is installed under DNX Core 5.

Following this answer , I moved both dlls under DNX 4.5.1 as suggested:

在此处输入图片说明

This has meant that the solution now builds, however I don't see any of the config add to StartUp.cs to enable and register Swagger. I have been trying to piece this together from examples for ASP.NET 4.5.1 but to no avail.

All I am currently seeing when I browse to http://MyApi/Swagger is a blank screen.

Can anybody let me know how I can register swagger with my API correctly?

Just Add

Blockquote

"Swashbuckle": "6.0.0-beta9"

Blockquote

To your Dependencies in the project.json file. Save the Project.json file and let the NPM Restore do its thing. Not sure why the other lower Stable builds don't work but this one does.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM