belav / csharpier

CSharpier is an opinionated code formatter for c#.
https://csharpier.com
MIT License
1.41k stars 98 forks source link

Use current `dotnet` host instead of global #1387

Closed PetSerAl closed 2 days ago

PetSerAl commented 2 days ago

Use current dotnet binary from DOTNET_HOST_PATH instead of just dotnet. Reasons:

  1. Global (in PATH) may not exist (when used Binaries, but not Installers).
  2. Global can have different runtime version.
  3. Consistent with outer tools (csc for example). https://github.com/dotnet/roslyn/blob/324fd25331c969cd742ba68eee09ffd4b6fd29e3/src/Compilers/Shared/RuntimeHostInfo.cs#L61-L64
  4. It is documented to be used for that purpose. https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-environment-variables#dotnet_host_path