question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue building Swagger during build-time on non-Windows platform

See original GitHub issue

In the wiki you describe how to wire up the generation to occur during build, which is of great value. However, when I run this on a Mac, I see that it’s specifically calling a tool from the Win folder, that’s an .exe. This fails on a Mac with the following error output at build-time.

Task "Exec" Environment Variables passed to tool: ASPNETCORE_ENVIRONMENT=Development "/Users/bradygaster/.nuget/packages/nswag.msbuild/13.3.0/build/../tools/Win/NSwag.exe" aspnetcore2openapi /assembly:/Users/bradygaster/source/Weather/bin/Debug/netcoreapp3.1/Weather.dll /output:swagger.json /var/folders/yd/yx7g3rbn1rn9n5x_pr65m0980000gn/T/tmp4180e802dbe54195a9ca0ca149253efb.exec.cmd: line 2: /Users/bradygaster/.nuget/packages/nswag.msbuild/13.3.0/build/../tools/Win/NSwag.exe: cannot execute binary file 1:7>/Users/bradygaster/source/Weather/Weather.csproj(15,5): error MSB3073: The command ""/Users/bradygaster/.nuget/packages/nswag.msbuild/13.3.0/build/../tools/Win/NSwag.exe" aspnetcore2openapi /assembly:/Users/bradygaster/source/Weather/bin/Debug/netcoreapp3.1/Weather.dll /output:swagger.json" exited with code 126. Done executing task "Exec" -- FAILED. 1:7>Done building target "NSwag" in project "Weather.csproj" -- FAILED. 1:7>Done Building Project "/Users/bradygaster/source/Weather/Weather.csproj" (default targets) -- FAILED.

Is there an upcoming fix for this? It seems limiting that this is only available on Windows, when .NET Core and MSBuild are available on on other platforms.

Would love to sync up on some ideas I have for using this, but they’d require it work on non-Windows as well, given the use-case.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
RicoSutercommented, Mar 26, 2020

You’re probably using $(NSwagExe) in your csproj which is the full .net binary, for .NET Core you need to use eg. $(NSwagExe_Core31)

see https://github.com/RicoSuter/NSwag/wiki/NSwag.MSBuild

0reactions
RicoSutercommented, Mar 26, 2020

The main problem without Newtonsoft is that System.Text.Json does not expose metadat/reflection api, see https://github.com/RicoSuter/NSwag/issues/2243

Sure I’m working from home and often available… 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Swagger Codegen Documentation
The Swagger Codegen is an open source code-generator to build server stubs and client SDKs directly from a Swagger defined RESTful API. The...
Read more >
Swagger Definition File Creation - Power Platform Community
Solved: I have an app developed under Project Siena that was retrieving results through an API service. The connection to the API was...
Read more >
Visual Studio 2017 and Swagger: Building ...
Execute the application, click the 'Start' button in the toolbar. · On the Swagger documentation page, click 'Values', the name of the controller ......
Read more >
Building and Enforcing API Standards at Scale with Swagger
Standardized API design is an important consideration that organizations must face in their journey in developing APIs that are easy to ...
Read more >
OpenAPI Swagger Editor Extension in VS Code
Tutorial on the 42Crunch OpenAPI (Swagger) Editor Extension for VS Code showing how to create a new OpenAPI file and some of the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found