I've been looking at different options for providing auto generated API Documentation and Swagger seems to be up there.
However when trying this out for the first time I'm getting exceptions on start up.
Running Visual Studio 2013.
Create new Web API project.
Using Package Manager, run:
Install-Package Swagger.Net & Install-Packager Swagger.Net.UI
Making sure we've enable the XML documentation we get this exception:
Method 'GetDocumentation' in type 'Swagger.Net.XmlCommentDocumentationProvider'
from assembly 'Swagger.Net, Version=0.5.1.0, Culture=neutral, PublicKeyToken=null'
does not have an implementation.
Does anyone else know of a step we are missing? We found & followed this:
https://github.com/Swagger-Net/Swagger.Net/wiki
https://github.com/Swagger-Net/Swagger.Net/blob/master/README.md
Swagger doesn't support .NET 4.5 - Had to get the source code out from git and modify it to work with 4.5.
Right click the project and set the target framework in there
I have made a library for use with mvc that generates the documentation for you based on attributes. It may be what your looking for.
MVC3: https://www.nuget.org/packages/SwaggerAPIDocumentation/
MVC4: https://www.nuget.org/packages/SwaggerAPIDocumentation.Mvc4/
MVC5: https://www.nuget.org/packages/SwaggerAPIDocumentation.Mvc5/
MVC5.1: https://www.nuget.org/packages/SwaggerAPIDocumentation.Mvc51/
There is dcoumentation in the repository on github just click the project site link. Hope this helps
Try using Swashbuckle.
Based on Swagger as far as I know and it worked first time for me...
https://github.com/domaindrivendev/Swashbuckle
Related
I'm trying to write a C# project that makes use of Bruel & Kjaer 2250 SDK. The SDK installer installs a VisualStudio 2015 Windows Form C# project that I'm able to build.
The next step for me was to create a similar project from scratch, so trying to do this and following litterally the BK instructions what happens is that I'm not able to create an instance of of class RemoteAPI in BK.BasicEnv.Application namespace.
I get an exception that tells me these informations:
An unhandled exception of type 'System.NullReferenceException'
occurred in BasicEnvRemoteAPI.dll
Additional information: RemoteAPI - Construction: No Instance of
EnvOfficeModel.
The constructor call is very simple:
private RemoteAPI api;
...
api = new RemoteAPI();
So the ctor of RemoteAPI is failing because an instance of EnvOfficeModel is missing to it,
I've googled a lot and made some tests but the result is always the same for my own project while the B&K example is correctly starting and is able to create an instance of the RemoteAPI class.
I also tried to compare the two projects and I'm not able to find a different setting, then I tried to search the B&K installed files and the registry for some hint about the possible causes of this behaviour, but no way ....
If some of you had the same problem and could perhaps drive me to the correct information to solve this problem will be a great thing.
I know that also a REST interface is available to communicate with BK2250 but I would like to use the native communication driver if possile.
Thank you and kind regards.
I encountered the issue today,
Verify that you imported the dll in the project correctly (Should appear under References if not it's probably the second issue)
Verify that you are using the .NET Framework and not the .NET Core
I managed to get it working with a Windows Form application using the .NET Framework 4.7.2
This is my first time posting here.
I am currently writing an ASP.NET MVC application (using .NET 4.5.2 and MVC 5). I want to integrate Hangfire into my project. I have set up a side project which worked. But when I tried to integrate it into my main project, several errors occurred. They are:
The .dll files had to be strong-named (I fixed this issue by using ildasm/ilasm to strong name them. I replace the original files that came with the nuget package.)
After strong-naming and replacing the files, I ran into another error. When I tried to build and run the solution, a 'GlobalConfiguration' does not exists in the current context, and also a are you missing an assembly reference error is thrown.
I have tried various ways to solve this, but to no avail. I would really like some advice on this ! Thanks !
GlobalConfiguration is a class in the Hangfire namespace. You should import the namespace so that you can use it (and the extension methods it provides)
using Hangfire;
So now code like this will work:
GlobalConfiguration.Configuration.UseSqlServerStorage("MyConnectionString");
I'm trying to create a class library for the new Microsoft Identity model but am being beaten back by an odd error.
If I create a regular C# Class Library (not a PCL) and attempt to install Microsoft.AspNet.Identity.EntityFramework.3.0.0-rc1-final via Nuget it goes so far, chokes, rolls back and then displays the following error:
Failed to add reference to 'System.Runtime'. Please make sure that it
is in the Global Assembly Cache.
I know that this is a pre-release version of the library but this cannot be such a radical idea that I'm trying to achieve here.
Any pointers greatly appreciated.
It seems to be a known issue and confirmed by Microsoft. It leads to this NuGet issue.
A workaround, according to the comments, is to install Microsoft.AspNetCore.Identity.EntityFrameworkCore, which is the RC2 equivalent. From what I can find this hasn't been officially released yet, and you might need to build from source.
I followed step by step this tutorial Getting Started with SignalR 2.0 and MVC 5.
After build I have 1 warning and 1 error (my Visual Studio is not in english, I translated the messages):
Conflicts between different versions of the same dependent assembly
impossible to solve. These conflicts of references are listed in the
build log when the level of detail of the log is set to detail
The type 'SignalRChat.Startup' already defines a member called 'Configuration' with the same parameter types.
I have read the tutorial carefully several times to find my mistake without success.
Can you please help me?
I use: Visual Studio Professional 2013 v.12.0.30110.00 Update 1, .Net Framework 4.5.51641, SignalR 2.0.2.
Thanks.
What changes should I do to be able to use it with a .Net desktop client?
Just to copy my comment from the OP...
The warning is not a huge problem (although should be resolved at some point - Google it for solutions).
As to the error... You've got 2 methods with identical signatures. That means you've either copied/pasted code wrong or you've got a partial class (class defined in 2 different files) both of which contain the same method.
Double-click the error, copy the method declaration and do a search of your solution for the same line. I haven't looked at the tutorial but you may also need to override/extend methods.
You'll see that error if you select a different authentication provider than the one specified in the tutorial.
I am implementing OpenID+OAuth in my ASP.NET WebForm (using .NET Framework 3.5) application, found example on net
https://groups.google.com/forum/?fromgroups=#!topic/dotnetopenid/xQYkE6sUZYU
But I am missing DotNetOpenAuth.ApplicationBlock namespace, I included these libraries in my project:
DotNetOpenAuth.dll
DotNetOpenAuth.OAuth2.dll
DotNetOpenAuth.OAuth2.Client.dll
Can any one suggest me where I am doing wrong?
The ApplicationBlock is not distributed in binary form as it is intended for copy+paste of relevant source code into your project. You can get the ApplicationBlock project from the samples distribution on SourceForge.
You can find the project under the DotNotOpenAuth folders at Samples/DotNetOpenAuth.ApplicationBlock