I have a webapi project, that is not using mvc. My package.config before Swashbuckle installation is as follows:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="3.3.1" targetFramework="net45" />
<package id="EntityFramework" version="6.1.3" targetFramework="net45" />
<package id="log4net" version="2.0.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net451" />
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net451" />
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net451" />
<package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net45" />
<package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net451" />
<package id="Ninject" version="3.2.2.0" targetFramework="net451" />
<package id="Ninject.Extensions.ContextPreservation" version="3.2.0.0" targetFramework="net451" />
<package id="Ninject.Extensions.Logging" version="3.2.2.0" targetFramework="net451" />
<package id="Ninject.Extensions.Logging.Log4net" version="3.2.2.0" targetFramework="net451" />
<package id="Ninject.Extensions.NamedScope" version="3.2.0.0" targetFramework="net451" />
<package id="Ninject.Web.Common" version="3.2.3.0" targetFramework="net451" />
<package id="Ninject.Web.Common.OwinHost" version="3.2.3.0" targetFramework="net451" />
<package id="Ninject.Web.WebApi" version="3.2.4.0" targetFramework="net451" />
<package id="Ninject.Web.WebApi.OwinHost" version="3.2.4.0" targetFramework="net451" />
<package id="Owin" version="1.0" targetFramework="net451" />
</packages>
When I try installing Swashbuckle, I'm getting this:
PM> Install-Package Swashbuckle
Attempting to resolve dependency 'Microsoft.AspNet.WebApi.WebHost (≥ 4.0.20710)'.
Attempting to resolve dependency 'Microsoft.Web.Infrastructure (≥ 1.0.0.0)'.
Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Core (≥ 4.0.20710.0 && < 4.1)'.
Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Client (≥ 4.0.20710.0 && < 4.1)'.
Attempting to resolve dependency 'Microsoft.Net.Http (≥ 2.0.20710.0 && < 2.1)'.
Attempting to resolve dependency 'Newtonsoft.Json (≥ 4.5.6)'.
Attempting to resolve dependency 'WebActivatorEx'.
Attempting to resolve dependency 'Swashbuckle.Core (≥ 5.1.5)'.
Installing 'Microsoft.Web.Infrastructure 1.0.0.0'.
Successfully installed 'Microsoft.Web.Infrastructure 1.0.0.0'.
Installing 'Microsoft.Net.Http 2.0.20710.0'.
You are downloading Microsoft.Net.Http from Microsoft, the license agreement to which is available at http://www.microsoft.com/web/webpi/eula/MVC_4_eula_ENU.htm. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'Microsoft.Net.Http 2.0.20710.0'.
Installing 'Microsoft.AspNet.WebApi.Client 4.0.20710.0'.
You are downloading Microsoft.AspNet.WebApi.Client from Microsoft, the license agreement to which is available at http://www.microsoft.com/web/webpi/eula/MVC_4_eula_ENU.htm. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'Microsoft.AspNet.WebApi.Client 4.0.20710.0'.
Installing 'Microsoft.AspNet.WebApi.Core 4.0.20710.0'.
You are downloading Microsoft.AspNet.WebApi.Core from Microsoft, the license agreement to which is available at http://www.microsoft.com/web/webpi/eula/MVC_4_eula_ENU.htm. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'Microsoft.AspNet.WebApi.Core 4.0.20710.0'.
Installing 'Microsoft.AspNet.WebApi.WebHost 4.0.20710.0'.
You are downloading Microsoft.AspNet.WebApi.WebHost from Microsoft, the license agreement to which is available at http://www.microsoft.com/web/webpi/eula/MVC_4_eula_ENU.htm. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'Microsoft.AspNet.WebApi.WebHost 4.0.20710.0'.
Installing 'WebActivatorEx 2.0.6'.
Successfully installed 'WebActivatorEx 2.0.6'.
Installing 'Swashbuckle.Core 5.1.5'.
Successfully installed 'Swashbuckle.Core 5.1.5'.
Installing 'Swashbuckle 5.1.5'.
Successfully installed 'Swashbuckle 5.1.5'.
Install failed. Rolling back...
Install-Package : Updating 'Microsoft.AspNet.WebApi.Core 5.2.3' to 'Microsoft.AspNet.WebApi.Core 4.0.20710.0' failed. Unable to find versions of
'Microsoft.AspNet.WebApi.Owin, Ninject.Web.WebApi' that are compatible with 'Microsoft.AspNet.WebApi.Core 4.0.20710.0'.
At line:1 char:1
+ Install-Package Swashbuckle
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
PM>
How do I resolve this (or work around) and install Swashbuckle?
Bonus question: why is it trying to install asp.net 4.* stuff when 5.* is already installed and available?
I was able to persuade Swashbuckle to successfully install by running the following commands in sequence:
PM> Install-Package Microsoft.AspNet.WebApi.WebHost
PM> Install-Package WebActivatorEx
PM> Install-Package Microsoft.AspNet.WebApi.Core
PM> Install-Package Swashbuckle.Core
PM> Install-Package Swashbuckle
Most helpful comment
I was able to persuade Swashbuckle to successfully install by running the following commands in sequence: