["ERROR" - 8:38:23 PM] CSharpier was not found so files may not be formatted.
It then tries to install from NuGet and seems to ignore the NuGet.Config in the project directory, so I got an error here too until I added the NuGet repo to $HOME/.nuget/NuGet/NuGet.Config.
So then when you try to format files, you get something like:
Formatting started for $PATH using NULL
Steps to reproduce
Set up a devcontainer using the image above.
Install the tool with dotnet tool install csharpier (using -g also does not work)
Remove the nuget.org repo from your packageSources in $HOME/.nuget/NuGet/NuGet.Config
Reload VS Code window
Try to format a .cs file
This is reproducible for me and my colleagues across our platforms, but may have something to do with our repo and/or devcontainer configuration.
Expected behavior
The extension should find the locally-installed tool and use it without needing to resort to fetching it from nuget.org. It would also be nice if it gave a little help in the UI when it's in this state. For me, when I removed the nuget.org repo from my $HOME config (but it was still in the repo config) and rebuilt the devcontainer, formatting suddenly stopped working. That was really unexpected and I wasn't sure where to go from there.
Actual behavior
The extension fails to find CSharpier, tries to install from NuGet, and if that fails, silently fails to format.
Workaround: ensure that the nuget.org repo is a package source in $HOME/.nuget/NuGet/NuGet.Config in the container and it should work OK, but will probably ignore the version you have configured in your repo .config/dotnet-tools.json if any.
Just want to add, though: we really like this extension. Microsoft's C# Dev Kit extension just doesn't cut it when it comes to code formatting. Thank you for this!
Environments
Log Output
It then tries to install from NuGet and seems to ignore the
NuGet.Config
in the project directory, so I got an error here too until I added the NuGet repo to$HOME/.nuget/NuGet/NuGet.Config
.So then when you try to format files, you get something like:
Steps to reproduce
dotnet tool install csharpier
(using-g
also does not work)packageSources
in$HOME/.nuget/NuGet/NuGet.Config
This is reproducible for me and my colleagues across our platforms, but may have something to do with our repo and/or devcontainer configuration.
Expected behavior
The extension should find the locally-installed tool and use it without needing to resort to fetching it from nuget.org. It would also be nice if it gave a little help in the UI when it's in this state. For me, when I removed the nuget.org repo from my $HOME config (but it was still in the repo config) and rebuilt the devcontainer, formatting suddenly stopped working. That was really unexpected and I wasn't sure where to go from there.
Actual behavior
The extension fails to find CSharpier, tries to install from NuGet, and if that fails, silently fails to format.
Workaround: ensure that the
nuget.org
repo is a package source in$HOME/.nuget/NuGet/NuGet.Config
in the container and it should work OK, but will probably ignore the version you have configured in your repo.config/dotnet-tools.json
if any.Just want to add, though: we really like this extension. Microsoft's C# Dev Kit extension just doesn't cut it when it comes to code formatting. Thank you for this!