News for hackers. Stuff that matters.
Re:.NET 10 Preview 6 brings JIT improvements, one-shot tool ... by Cu3PO42 on Wednesday July 30, 2025 @11:43AM (#44735676)
dotnet format [0] exists and is maintained by the .NET team. It is different from Prettier in that it is much more configurable, but it gets the job done for us. It does integrate language services and can automatically apply code fixes for custom analyzers. I have not explicitly tried roslynator or stylecop, but I suspect this would work as expected.

[0] https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-f...

Re:.NET 10 Preview 6 brings JIT improvements, one-shot tool ... by rafaelmn on Wednesday July 30, 2025 @11:48AM (#44735756)
> It is different from Prettier in that it is much more configurable

I only tried it briefly but found it was waaay to lenient with the amount of variance in style it left unchanged (eg line breaks for function parameters) - can it get configured to produce consistent formatting like prettier ?

Re:.NET 10 Preview 6 brings JIT improvements, one-shot tool ... by eterm on Wednesday July 30, 2025 @11:58AM (#44735898)
I think there are also a lot of default rules which aren't enforced until they're bumped up in severity in the .editorconfig.

Also it can hook into roslyn analyzers, so if you want a more opinionated analyzer then stylecop analyzers ( https://github.com/DotNetAnalyzers/StyleCopAnalyzers) would be an option, although I haven't used it myself for a long time.

Re:.NET 10 Preview 6 brings JIT improvements, one-shot tool ... by Cu3PO42 on Wednesday July 30, 2025 @11:58AM (#44735896)
It can be configured to be much more aggressive with formatting, but I'm not certain if you can force it to produce the exact same output for any possible whitespace in the input.
Re:.NET 10 Preview 6 brings JIT improvements, one-shot tool ... by jswny on Wednesday July 30, 2025 @03:23PM (#44738473)
The problem is that dotnet format is horribly slow. So much so that it's only useful as a precommit hook
Re:.NET 10 Preview 6 brings JIT improvements, one-shot tool ... by malkia on Wednesday July 30, 2025 @07:38PM (#44740817)
I was not able to use (recent) dotnet-format as standalone .exe tool, also it only worked if inside an actual project with .sln/.slnx file and all that. I could not instruct it to work on single file.