问题描述
我已经使用NSwagStudio在c#中生成客户端代理。我将项目保存到一个.nswag文件中。我已将其添加到我的.net核心控制台应用程序。然后,我在包管理器控制台中使用以下命令
nswag.cmd run .\client.nswag /runtime:NetCore31
我明白了
NSwag command line tool for .NET Core NetCore31,toolchain v13.7.4.0 (NJsonSchema v10.1.26.0 (Newtonsoft.Json v12.0.0.0))
Visit http://NSwag.org for more information.
NSwag bin directory: C:\Users\mypc\AppData\Roaming\npm\node_modules\nswag\bin\binaries\NetCore31
Executing file '.\client.nswag' with variables ''...
Done.
但是我看不到创建的输出文件。该文件保存在哪里?
解决方法
您需要通过以下任一方式定义输出文件:
- 为
output
中的nswag.json
变量赋值:"output": "<your_path>/client.cs"
- 将其作为参数传递给您的cli *调用:
nswag.cmd run .\client.nswag /runtime:NetCore31 /output:<your_path>/client.cs
*如果您沿着那条路走,NSwag.MSBuild
同样适用:
$(NSwagExe_Core31) run .\client.nswag /runtime:NetCore31 /output:<your_path>/client.cs