Configuring Swashbuckle - rest

I'm having problems getting Swashbuckle to run..
I installed packages:
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
I cant navigate to /swagger... how can I make my api to get swagger?

Link Will guide you because Microsoft is supporting now.

Related

Not able to use Nuget in Visual Studio 2012?

I am getting this error:
PM> Install-Package GemBox.Document -Version 33.0.1290
The source at nuget.org [https://www.nuget.org/api/v2/] is unreachable. Falling back to NuGet Local Cache at C:\Users\ho7035\AppData\Local\NuGet\Cache
Install-Package : Unable to find version '33.0.1290' of package 'GemBox.Document'.
At line:1 char:1

The term 'Scaffold-DbContext' is not recognized as the name of a cmdlet

I have a solution with two project, one is the main project and the second a project that will use EF Core 10.0 RC2.
In the second project I use this three commands to install EF Core and run this nuget commands to install it:
Install-Package Microsoft.EntityFrameworkCore.SqlServer –Pre
Install-Package Microsoft.EntityFrameworkCore.Tools –Pre
Install-Package Microsoft.EntityFrameworkCore.SqlServer.Design –Pre
Later I can create my model from a database with this command:
Scaffold-DbContext "'Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;'" Microsoft.EntityFrameworkCore.SqlServer
The problem is that if I exit VS2015 and open again, if I have tried to run the same command to generate again the models, I get this error:
The term 'Scaffold-DbContext' is not recognized as the name of a
cmdlet.
I don't know what is the problem, I have tried to install the entityFrameworks.Commands but the problem is not solved.
Have you tried the command:
dotnet restore --infer-runtimes
For more information, you can visit: https://github.com/aspnet/EntityFramework/issues/5549, it worked for someone.
Don't forget to run visual studio as Administrator or you get that error

Nuget install fails for pre-release package with dependencies

I have two pre-release nuget packages A.nuget and B.nuget, and B depends on A.
Install A.nuget works:
nuget.exe install A -Source E:\out\packages -OutputDirectory e:\NugetCache -Prerelease -PackageSaveMode nuspec;nupkg
Installing B.nuget fails:
nuget.exe install B -Source E:\out\packages -OutputDirectory e:\NugetCache -Prerelease -PackageSaveMode nuspec;nupkg
Unable to resolve dependency 'A.1.0.0.196-moma159241025'
I double checked and A.1.0.0.196-moma159241025 is installed under e:\NugetCache.
How can I resolve this error?
The work-around I use to solve this uses the -IgnoreDependencies switch, meaning the chosen package will install without its dependencies, regardless of whether Nuget can find them or not.
Install all packages "B" depends on (including "A")
Install package "B" using the -IgnoreDependencies switch
Install-Package A -IncludePrerelease
Install-Package SomeDependencyFromB
Install-Package SomeOtherDependencyFromB
Install-Package B -IncludePrerelease -IgnoreDependencies
https://docs.nuget.org/consume/package-manager-console-powershell-reference

Dependencies error while installing packages with NuGet

I'm trying to install the following packages with NuGet on Visual Studio 2010
TweetSharp version 2.3.1 (which requires Newtonsoft.Json version 5.0.6)
SharpMap version 1.1.0 (which requires Newtonsoft.Json version 4.5.11)
using the following simple NuGet commands:
PM> Install-Package TweetSharp
PM> Install-Package SharpMap
however I'm getting the following dependencies error after installing the second package:
Install failed. Rolling back...
Install-Package : Updating 'Newtonsoft.Json 5.0.6' to 'Newtonsoft.Json 4.5.11' failed. Unable to find a version of 'TweetSharp' that is compatible with 'Newtonsoft.Json 4.5.11'.
At line:1 char:16
+ Install-Package <<<< SharpMap
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
is there anyway to fix this issue? thanks in advance.
The problem is that SharpMap has defined the dependency to be exactly
NewtonSoft.Json = 4.5.11
Not greater than or equal, but exactly equal. The best way forward is to contact the owners of the package and ask them to loosen the requirements. It's not very useful like it is, for exactly the reason demonstrated in this question.
However, you can attempt to use the -IgnoreDependencies switch:
> Install-Package SharpMap -IgnoreDependencies
This installs only SharpMap, so you'll need to explicitly install all the other dependencies (except NewtonSoft.Json) afterwards:
> Install-Package BruTile -Version 0.7.4.4
> Install-Package Common.Logging -Version 2.0.0
> Install-Package GeoAPI -Version 1.7.2
> Install-Package NetTopologySuite -Version 1.13.2
> Install-Package NetTopologySuite.IO -Version 1.13.2
> Install-Package ProjNET4GeoAPI -Version 1.3.0.3
However, SharpMap is still going to look for NewtonSoft.Json 4.5.11, so you'll need to add an assembly binding redirect in your application configuration file:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json"
publicKeyToken="30ad4fe6b2a6aeed"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.6.0"
newVersion="5.0.6.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
This may work, but I haven't tried, because in the end, it'll depend on how you want to use these two libraries together.
The shift in major versions of Json.NET indicates that there are breaking changes between 4.x and 5.0, so if SharpMap relies on some of the features of Json.NET 4.5.11 that are affected by the breaking changes, it's not going to work.
However, in my experience, using newer versions of Json.NET with libraries compiled against older versions tend to work fine, so it's worth a shot.

is there an updated version for Hottowel.angular.breeze -pre install package?

i tried installing this package and got the following error.
Install-Package : Updating 'Microsoft.AspNet.WebApi.OData 5.0.0' to 'Microsoft.AspNet.WebApi.OData 4.0.30506' failed. Unable to find a version of 'Breeze.Server.WebApi2' that is compatible with
'Microsoft.AspNet.WebApi.OData 4.0.30506'.
At line:1 char:1
+ Install-Package HotTowel.Angular.Breeze -Pre
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
any help is appreciated,
thanks
Thanks for watching my course! Some of you have let me know that there are some issues with the newest WebApi NuGet packages. Once these are resolved (coordinating with Microsoft and Breeze folks) I will let you all know. In the meantime, here is the workaround which is quite simple:
For now, the easiest thing to do is install the nuget packages in this order. I am working with the Breeze team and the ASP.NET team to make this easier soon :)
Install-Package Microsoft.AspNet.WebApi -version 4.0.30506.0
Install-Package Microsoft.AspNet.WebApi.Odata -version 4.0.30506.0
Install-Package EntityFramework.SqlServerCompact -version 4.3.6
install-Package HotTowel.angular -pre
Install-Package HotTowel.angular.breeze -pre
The first 3 ask it to use the WebApi 4.0.30506 ... which makes it all work. Once I get confirmation from the Breeze team on some changes and check them with the Web Api team, I will update this and let everyone know how to make it work with Web API v2.
Thanks again for your support!
UPDATE
You can now use EF6, Web API v2 with Breeze 1.4.5. Just install HotTowel.
Install-Package HotTowel.Angular.Breeze -pre