I need to generate the swagger client SDK for my rest api in .net core project. The option "New REST API Client" is not in the context menu for the project under Add. How do I get it (or otherwise generate the SDK for my project so I can write simple tests)?
Currently, generate new REST API client option is not available for .NET Core projects. You can use tools like NSwagStudio or autorest or Open API Generator to generate clients.
Related
In Visual Studio for .net projects I can use built in tools to generate API clients by swagger. It simply and works great.
This option is missing from Windows Runtime projects as well, like Windows 10 IOT ones.
What is the best way to create API clients by swagger for this? If there is no built in tool / extension for VS, any external tools are highly appriciated.
Thanks a lot!
I don't get your question completely; on Windows IOT Core you can run UWP (background) apps; they are compatible with .net framework and .net standard up to version 1.4. This should work with a generated client from swagger.
Also you can use Refit to create a REST client according to best practices based upon an interface with attribute decorations.
Context
I would like to use AutoRest generated client for a webapi service by using "Add"/"REST API Client..." in visual studio 2017.
However, it gives the following error:
[Info]AutoRest Core 0.16.0.0
...
[Fatal]Error generating client model: Collection format "multi" is not supported (in parameter 'xxx').
The older version of AutoRest (e.g. 0.16.0) does not support "multi" collection format. So I installed the latest version AutoRest 0.17.3. using Nuget. But when I use "Add"/"REST API Client...", it still uses 0.16.0 version AutoRest and gives me the same error. It seems visual studio 2017 has a built-in AutoRest version 0.16 assembly.
Question
How do I get the latest version of AutoRest and integrate it in Visual studio 2017?
I also had this problem so I built a tool for it called REST API Client Code Generator. I worked in teams where we used tools like AutoRest, NSwag, and Swagger Codegen to generate our REST API Clients and it always annoyed me that the "Add New - REST API Client..." tooling in Visual Studio didn't always work and was very troublesome when it was time to re-generate the client
The REST API Client Code Generator piggy backs on top of AutoRest, NSwag, and the Java SDK for Swagger Codegen CLI and OpenAPI Codegen CLI. So to be able to use AutoRest you will need Node.js to be installed and then you need to manually install AutoRest using NPM
npm install -g autorest
Using the tool will add the Swagger.json file to the C# project and set a custom tool to it so every time the changes are made to the Swagger.json file, the API Client code is re-generated. You will have to manually update the Swagger.json file though if you use Auto, NSwag, Swagger Codegen, OpenAPI Codegen though. But if you chose to use NSwag Studio to generate code then you can just re-generate the code directly from the .nswag file from the C# project
I am new to Mac and was trying to build a Web API2 with Visual Studio 2017 for Mac. I am not able to see Web API 2 packages (Controller option is missing, I am able to create a MVC project but even when I select Empty Web Application -> Web API only)
I do not see API Controller and all Web API 2 options. Is there way to find and use these?
While doing R&D I found that by default VS for Mac has your API project opened with Mono framework, when you go to Project -> Options (Properties) -> General ...you can change framework as .Net 4.x (upto 4.6.1) available as of now. Once done, you would be able to happily developer web API 2..
Posted here so it can be helpful for someone looking for same options :)
I'm currently working on Xamarin.Android and xamarin.iOS project using mvvmcross.Now i have to consume Soap service via PCL? How can I do that ?I have read in few tutorials that you have to generate the Proxy class manually. Please let me know the feasible approach for this question.Also if there is any other way around.
If you do not target Windows Phone 8.1 (which doesn't support SOAP out-of-the-box), you can just right click References in your PCL project and Add a new service reference. It will generate the proxies automatically as it would in a classic .NET project.
when right click the property of the project in vs2010, what's the difference of the target framework with or without client profile?
thanks.
The client profile is a subset of the complete .NET 4 framework, aimed at client side applications. It allows users to have a smaller download and install, leaving out the bits they wouldn't normally use.
However depending upon your application, and which bits of the framework you want to use, you may need the complete version and not the client. For example if you want to access the Membership provider stuff from a WinForms app you'll need the full and not client.
See this for more info:
Differences between Microsoft .NET 4.0 full Framework and Client Profile