简体   繁体   中英

Linux NSwag NPM CLI-framework Microsoft.NETCore.App version 2.1.0 was not found

Even after setting nswag version /runtime:NetCore31 the command nswag help and others throws the following error:

NSwag NPM CLI It was not possible to find any compatible framework version The framework 'Microsoft.NETCore.App', version '2.1.0' was not found. - The following frameworks were found: 3.1.3 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at: - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=2.1.0&arch=x64&rid=fedora.30-x64 child_process.js:660 throw err; ^

Error: Command failed: dotnet "/usr/lib/node_modules/nswag/bin/binaries/NetCore21/dotnet-nswag.dll" help
    at checkExecSyncError (child_process.js:621:11)
    at Object.execSync (child_process.js:657:15)
    at /usr/lib/node_modules/nswag/bin/nswag.js:69:11
    at ChildProcess.exithandler (child_process.js:286:7)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:430:11)
    at Socket.emit (events.js:210:5)
    at Pipe.<anonymous> (net.js:659:12) {
  status: 150,
  signal: null,
  output: [ null, null, null ],
  pid: 10831,
  stdout: null,
  stderr: null
}

I wonder if NSwag requires 2.1.0 or if it's a wrong environment setup (Linux/Fedora 30)

Following this answer , wiki.archlinux.org/.NET_Core and this issue , it worked with the following steps:

dotnet --list-sdks

3.1.201 [/usr/share/dotnet/sdk]

Install required .NET version (worked only on the same folder as current SDK)

./dotnet-install.sh -Version 2.1.805 --install-dir /usr/share/dotnet

Then set runtime, as described on NSwag tutorial

nswag version /runtime:NetCore31

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM