Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nswag CLI doesn't work on MacOS High Sierra with DotNet Core 2.0 #1167

Closed
viktorsteinwand opened this issue Jan 31, 2018 · 10 comments
Closed

Comments

@viktorsteinwand
Copy link

Following exceptions are thrown if using nswag CLI:

➜ nswag
NSwag NPM CLI
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '1.1.2' was not found.

  • Check application dependencies and target a framework version installed at:
    /
  • Alternatively, install the framework version '1.1.2'.
    child_process.js:644
    throw err;
    ^

Error: Command failed: dotnet "/usr/local/lib/node_modules/nswag/bin/binaries/NetCore11/dotnet-nswag.dll"
at checkExecSyncError (child_process.js:601:13)
at Object.execSync (child_process.js:641:13)
at c.exec (/usr/local/lib/node_modules/nswag/bin/nswag.js:65:11)
at ChildProcess.exithandler (child_process.js:267:7)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Socket.stream.socket.on (internal/child_process.js:346:11)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
➜ dotnet --version
2.0.0

@RicoSuter
Copy link
Owner

Add the parameter /runtime:NetCore20 to enforce the .NET Core 2.0 runtime...

@RicoSuter
Copy link
Owner

@RicoSuter
Copy link
Owner

v11.14.0:

We improved the assembly loader (mainly for .NET Core) so that it runs in a more isolated space and the loaded DLLs should better match the requested versions. Please test this with your projects to ensure that we didnt introduce regressions.

Important if you have DLL loading problems:

  • Check that the DLL in question is available in the output directory (where the selected assembly is located) or in ReferencePaths
  • Check that you selected the correct runtime: Either in NSwagStudio UI, as /runtime parameter in the NPM CLI or execute the correct exe binary

For more information regarding assembly loading: https://github.com/RSuter/NSwag/wiki/Assembly-loading

Main commit: 04576e4#diff-14dafe6661bab407ae5c0d7095ccd1f4

@viktorsteinwand
Copy link
Author

Updated to the latest version via npm:

➜ nswag /runtime:NetCore20
NSwag NPM CLI
NSwag command line tool for .NET Core NetCore20, toolchain v11.14.0.0 (NJsonSchema v9.10.24.0 (Newtonsoft.Json v9.0.0.0))
Visit http://NSwag.org for more information.
NSwag bin directory: usr/local/lib/node_modules/nswag/bin/binaries/NetCore20
Commands:
  help
  aspnetcore2swagger
  version
  list-types
  list-controllers
  types2swagger
  webapi2swagger
  new
  run
  jsonschema2csclient
  jsonschema2tsclient
  swagger2csclient
  swagger2cscontroller
  swagger2tsclient
Command: version

NSwag version: 11.14.0.0
NJsonSchema version: 9.10.24.0 (Newtonsoft.Json v9.0.0.0)

Duration: 00:00:23.2289930

However the latest available runtime cannot be found:

➜ nswag
NSwag NPM CLI
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '1.1.2' was not found.
  - Check application dependencies and target a framework version installed at:
      /
  - Alternatively, install the framework version '1.1.2'.
child_process.js:644
    throw err;
    ^

Error: Command failed: dotnet "/usr/local/lib/node_modules/nswag/bin/binaries/NetCore11/dotnet-nswag.dll"
    at checkExecSyncError (child_process.js:601:13)
    at Object.execSync (child_process.js:641:13)
    at c.exec (/usr/local/lib/node_modules/nswag/bin/nswag.js:65:11)
    at ChildProcess.exithandler (child_process.js:267:7)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Socket.stream.socket.on (internal/child_process.js:346:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)

@RicoSuter
Copy link
Owner

Yes, if you do not specify a runtime, it uses .net core 1.1 which seems to be not installed on your system... this behavior is expected. You always have to specify the runtime...

@Bomret
Copy link

Bomret commented Mar 21, 2018

Are there any plans to deprecate the use of .net core 1.1 and switch to 2.x?

@RicoSuter
Copy link
Owner

I don't think we will deprecate 1.1 soon, just add /runtime:NetCore20 as cmd parameter and it should work... isnt this the case?

@Bomret
Copy link

Bomret commented Mar 21, 2018

It is. Was just a thought because 1.1 is barely mentioned anymore by MS and basically legacy already.

@RicoSuter
Copy link
Owner

Ok, I think I will not remove it but change the default to .NET Core 2.0 or 2.1 in the summer... (next major release)

@RicoSuter
Copy link
Owner

Breaking defaults updated: #984

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants