C
C#6mo ago
Leemyy

dotnet tool not recognized after local install

I am trying to locally install the tool dotnet-mgcb-editor from nuget into my repository. But it's not recognized after the installation. Here are the commands I executed to install it, aswell as their output.
>dotnet new tool-manifest
The template "Dotnet local tool manifest file" was created successfully.

>dotnet tool install --local dotnet-mgcb-editor --version 3.8.1.303
You can invoke the tool from this directory using the following commands: 'dotnet tool run mgcb-editor' or 'dotnet mgcb-editor'.
Tool 'dotnet-mgcb-editor' (version '3.8.1.303') was successfully installed. Entry is added to the manifest file <repo>\.config\dotnet-tools.json.
>dotnet new tool-manifest
The template "Dotnet local tool manifest file" was created successfully.

>dotnet tool install --local dotnet-mgcb-editor --version 3.8.1.303
You can invoke the tool from this directory using the following commands: 'dotnet tool run mgcb-editor' or 'dotnet mgcb-editor'.
Tool 'dotnet-mgcb-editor' (version '3.8.1.303') was successfully installed. Entry is added to the manifest file <repo>\.config\dotnet-tools.json.
When I run dotnet tool list, this is the output:
Package Id Version Commands Manifest
----------------------------------------------------------------------------------------
dotnet-mgcb-editor 3.8.1.303 mgcb-editor <repo>\.config\dotnet-tools.json
Package Id Version Commands Manifest
----------------------------------------------------------------------------------------
dotnet-mgcb-editor 3.8.1.303 mgcb-editor <repo>\.config\dotnet-tools.json
But when I try to run the tool, I get an error:
> dotnet mgcb-editor
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet-mgcb-editor-windows does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
> dotnet mgcb-editor
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet-mgcb-editor-windows does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Here's the output of running dotnet --info in the same repository:
.NET SDK (reflecting any global.json):
Version: 6.0.417
Commit: 04fde1d2e3

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.417\

Host:
Version: 8.0.0
Architecture: x64
Commit: 5535e31a71

.NET SDKs installed:
6.0.417 [C:\Program Files\dotnet\sdk]
8.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
<repo>\global.json
.NET SDK (reflecting any global.json):
Version: 6.0.417
Commit: 04fde1d2e3

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.417\

Host:
Version: 8.0.0
Architecture: x64
Commit: 5535e31a71

.NET SDKs installed:
6.0.417 [C:\Program Files\dotnet\sdk]
8.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
<repo>\global.json
And here's the content of my global.json:
{
"sdk": {
"version": "6.0.300",
"rollForward": "latestFeature"
}
}
{
"sdk": {
"version": "6.0.300",
"rollForward": "latestFeature"
}
}
I have tried installing the tool globlally, too, but it leads to the same error. Any pointers or advice would be greatly appreciated, as I am kind of lost here.
4 Replies
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
Leemyy
Leemyy6mo ago
Hmm, that worked for the other tool I was trying to install, but this one is still giving me the same error. Even after a full restart.
Unknown User
Unknown User6mo ago
Message Not Public
Sign In & Join Server To View
Leemyy
Leemyy5mo ago
I solved the issue. In case anyone stumbles upon this in the future, the issue is in this innocuous little line: * You intended to execute a .NET program, but dotnet-mgcb-editor-windows does not exist. Notice how it doesn't say dotnet-mgcb-editor? Yeah well I did not. The solution is to also add dotnet-mgcb-editor-windows (or -linux/-mac) as a tool. Tl;dr: make sure your .config/dotnet-tools.json contains all these entries:
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-mgcb": {
"version": "3.8.1.303",
"commands": [
"mgcb"
]
},
"dotnet-mgcb-editor": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor"
]
},
"dotnet-mgcb-editor-linux": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-linux"
]
},
"dotnet-mgcb-editor-windows": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-windows"
]
},
"dotnet-mgcb-editor-mac": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-mac"
]
}
}
}
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-mgcb": {
"version": "3.8.1.303",
"commands": [
"mgcb"
]
},
"dotnet-mgcb-editor": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor"
]
},
"dotnet-mgcb-editor-linux": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-linux"
]
},
"dotnet-mgcb-editor-windows": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-windows"
]
},
"dotnet-mgcb-editor-mac": {
"version": "3.8.1.303",
"commands": [
"mgcb-editor-mac"
]
}
}
}
And then run dotnet tool restore.
Want results from more Discord servers?
Add your server
More Posts