04
6

NSwag.MSBuild使用

0
归档:2024年6月分类:C#和.NET
内容纲要

Package: NSwag.MSBuild

Important for .NET Core: Assembly loading#net-core

After installing the NSwag.MSBuild NuGet package in your project, you can use the variable $(NSwagExe) in your .csproj file to run the NSwag command line tool in an MSBuild target. This way the tools can easily be updated via NuGet. The /controller parameter can be omitted to generate a Swagger specification for all controllers.




For better testability and stable output (defaults may change), it is recommended to create an NSwag Configuration Document (e.g. with NSwagStudio) and use:



Recommended for .NET Core/NET5 and later:


OnBuildSuccess



For more information about the missing DLLs in .NET Core, see Assembly loading#net-core.

More information on nswag run.

Runtime:

If you need to run the NSwag command line in x86 mode, use the $(NSwagExe_x86) placeholder. For .NET Core projects, one of the placeholders $(NSwagExe_Core##) or $(NSwagExe_Net##) (e.g. $(NSwagExe_Core31) for .NET Core 3.1) should be used instead of $(NSwagExe).

Available properties:

NSwagExe
NSwagExe_x86
NSwagExe_Core21
NSwagExe_Core31
NSwagExe_Net50
NSwagExe_Net60
NSwagExe_Net70
NSwagDir
NSwagDir_Core21
NSwagDir_Core31
NSwagDir_Net50
NSwagDir_Net60
NSwagDir_Net70
NSwag.MSBuild.props

See Command Line for more information.

Also see ServiceProjectReference for the new feature.


声明: 本文采用 BY-NC-SA 协议进行授权. 未标注“转”的文章均为原创,转载请注明转自: NSwag.MSBuild使用

上一篇: 下一篇:

公告栏

欢迎大家来到我的博客,我是dodoro,希望我的博客能给你带来帮助。