xt0rted/dotnet-format

dotnet format not installed

anthony-steele-cko opened this issue · 1 comments

This is likely a newbie error, but it's not documented.

When running, I get:

Run dotnet format1s
(node:2726) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Run xt0rted/dotnet-format@v1
Checking 22 files
/usr/bin/dotnet format --check --dry-run --files BunchOfFiles

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 Core program, but dotnet-format 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.

So it looks like this tool assumes that dotnet format is insalled. But it is not in this case. Is there a simple option to add? A place where I should add in a run: dotnet tool install -g dotnet-format ?

After a bit of digging, what I found that I needed was a "tool manifest file", See here

To create the file, run

dotnet new tool-manifest
dotnet tool install dotnet-format

The the file should be located at .config\dotnet-tools.json.
It should contain the dotnet-format entry,
then the Restore dotnet tools step will pick it up, i.e I see this output from the "restore dotnet tools" step:

Run xt0rted/dotnet-tool-restore@v1
/usr/bin/dotnet tool restore

Welcome to .NET Core 3.1!
... wall of text ...
Tool 'dotnet-format' (version '4.1.131201') was restored. Available commands: dotnet-format

Restore was successful.