简体   繁体   English

使用 Nswag 控制台(来自 NPM 包)以生成 C# 客户端

[英]Use Nswag Console (from NPM package) in order to generate C# client

According to the official Nswag command line docs it is possible to use Nswag via NPM console package (and subsquently generate C# client using openapi2cscontroller ):根据官方 Nswag命令行文档,可以通过 NPM 控制台 package 使用 Nswag(然后使用openapi2cscontroller生成 C# 客户端)

To use the command line tool nswag.exe (.NET 4.6+) / dotnet-nswag.dll (.NET Core), choose one of the following methods:要使用命令行工具 nswag.exe (.NET 4.6+) / dotnet-nswag.dll (.NET Core),请选择以下方法之一:

  • NSwag NPM Module: Bindings for the .NET 4.6+ and .NET Core command line tools (depending on installed framework/OS platform) NSwag NPM 模块:.NET 4.6+ 和 .NET 核心命令行工具的绑定(取决于安装的框架/操作系统平台)

  • ... ...

Sadly, except for the link there is no further documentation in that matter.可悲的是,除了链接之外,没有关于这件事的进一步文档。 I have installed the package linked in the documentation (using npm install nswag --save-dev ), it is however either broken or further undocumented steps are required:我已经安装了文档中链接的 package (使用npm install nswag --save-dev ),但是它要么损坏,要么需要进一步的未记录步骤:

> nswag new
> nswag : The term 'nswag' is not recognized as the name of a cmdlet, function, script file, or operable program.

You can install nswag as global:您可以将 nswag 安装为全局:

npm i -g nswag

or use local package或使用本地 package

node_modules\.bin\nswag

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 NSwag:从多个版本的 API 生成 C# 客户端 - NSwag: Generate C# Client from multiple Versions of an API 使用 NSwag 生成 C# 客户端错误地在同一个文件中创建了 2x 个同名的部分类 - Using NSwag to generate a C# client incorrectly creates 2x partial classes with the same name, in the same file 在 NSwag 中是否可以只生成 C# 客户端接口并使用一些自定义属性注释它们的方法? - Is it possible in NSwag to generate just C# client interfaces and annotate their methods with some custom attributes? NSwag:你如何使用自定义值 Object 类型 C# -> Swagger -> ZD7EFA19FBE7D23D772FDZ客户端560FBE7D23D7724客户端? - NSwag: How do you Use Custom Value Object Types in C# -> Swagger -> C# client? 生成 NSwag 客户端作为构建的一部分 - Generate NSwag client as part of the build NSwag:生成 C# 客户端导致代码无效 - NSwag: Generation of a C# client results in invalid code C# OpenApi Nswag 客户端生成复合体 Class 为空 - C# OpenApi Nswag Client Generation Complex Class is empty 从WSDL生成C#,无需“订购” - Generate C# from WSDL, without “Order” C# 带有 NSwag 的多态模型 - C# Polymorphic models with NSwag 从 c# 控制台应用程序运行 npm init - Run npm init from the c# console app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM