如何从OpenAPI定义中生成Visual Basic .NET客户端?
我需要从Visual Basic .NET项目(.NET Framework 3.5)调用REST API。他们给了我一个openapi .yaml文件。在Swagger编辑器中,我无法为Visual Basic生成客户端,仅用于C#。我试图将JSON从Swagger编辑器中导出,并将其粘贴在Visual Studio中,但是生成的班级似乎是不正确且不完整的。
有没有一种方法可以从OpenAPI定义中生成Visual Basic .NET客户端?
I need to call a REST API from a Visual Basic .NET project (.NET Framework 3.5). They gave me an OpenAPI .yaml file. In the Swagger Editor I can't generate the client for Visual Basic, only for C#. I tried to export the JSON from the Swagger Editor and paste it as a class in Visual Studio, but the generated class seems to be incorrect and incomplete.
Is there a way to generate a Visual Basic .NET client from an OpenAPI definition?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现了使用NSWAG库
https://github.com/ricososuter// nswag/wiki/offinglobalasax#集成
nuget intern
webapiconfig.vb
web.config
I found something that works for me using NSwag library
https://github.com/RicoSuter/NSwag/wiki/OwinGlobalAsax#integration
nuget install
WebApiConfig.vb
Web.Config
VB.NET可以使用C#组件(DLL),Visual Studio很乐意构建混合的项目。
这使得使用来自完全vb.net的应用程序生成的C#客户端非常简单。您可以在相同的VS解决方案中将摇摇欲坠的代码添加到自己的独立项目中。
VB.Net can use C# assemblies (dlls), and Visual Studio is happy to build mixed projects.
This makes it fairly simple to use a C# client generated by Swagger from an app that is otherwise fully VB.Net. You can add the Swagger-generated code to it's own separate project in the same VS solution.