tl;dr: Use SonarLint and optionally StyleCop.
The JavaScript ecosystem has amazing tools for formatting and statically analyzing your code: Pretti...
For further actions, you may consider blocking this person and/or reporting abuse
Thank you for the research - it's very useful.
It worth to mention that ReSharper costs $299 for organizations.
As for me, I have dotUltimate personal subscription that costs me $89/year and has much more than just ReSharper - it includes pretty much everything that C# developer would need.
But you are right that ReSharper is worthless for a project more than 300K lines of code because of performance issues.
I checked VS2022 + ReSharper - it's much better, I would say.
My guess that it's because VS2022 is a 64bit process.
But anyway, I switched to JetBrains Rider almost 4 years ago and never looked back.
Great article, thanks.
However I'd advice against using
ruleset
s at this time and migrate to.editorconfig
s which offer more options (but you'll loose the GUI for editingruleset
s - which have its quirks for .NET Core projects anyway). See docs.microsoft.com/en-us/visualstu.... You can port between the two, see github.com/dotnet/roslyn/issues/41393.Also there are two more analyzers worth mentioning: Roslynator and FxCop. FxCop is now part of the .NET SDK (since 5.0) and renamed to .NET analyzers. Several rules have been discontinued and a lot of rules (or all, depends on
TargetFramework
) are disabled by default. See docs.microsoft.com/en-us/dotnet/fu....Thanks for bringing this up Honza. I did not know you could configure rules via
.editorconfig
. I'll try to get that working and then update the post accordingly.Reference on how to use
.editorconfig
to configure rules: docs.microsoft.com/en-us/visualstu...Love this post, thank you for all the research. Have you looked into any solutions adding this to a build pipeline or check in process? I'd really love to have an automated task in the PR to run this and commit styles changes to keep everything correct.
Thanks! The Johnny Reilly post I linked shows how to automate dotnet-format with a precommit hook. I don't think it will be possible to automate any of the other tools to the same extent.
Since SonarLint and StyleCop generate build warnings, you will see those warnings in CI. Here's a screenshot of a Sonar warning from my Azure Pipelines build:
If you want an opinionated formatter for c# you should check out github.com/belav/csharpier, it is coming along nicely. The formatting is fairly stable at this point, I am mostly just dealing with edge cases.
This is definitely my favorite tool. Hands off. Makes for those who do a lot of Typescript.
Best post on the subjekt I've come across. Very well put together! It's highly appreciated.
Thank you!
Thanks for the link to my Prettier post Sam! I've since written a follow up more specifically on linting as I've been digging into the wonderful world of Roslyn Analyzers. blog.johnnyreilly.com/2022/04/06/e...
Just to add another tool to the mix.
jetbrains.com/help/resharper/ReSha...
is free.
We are just starting to try it out, to see if we can do some style cleanup in bulk on older codebases.
Great article!Thank you for the information and documentation!I am still learning so I'll stick with Resharper for now, good to know SonarLint for the future, cheers!
Thanks. it's great
Hi, I think you should combine these with husky.net, check it out
github.com/alirezanet/Husky.Net
CSharpier is another great tool! csharpier.com/docs/About
Hi Sam
The article is very helpful. But, I wonder if any of these tools can be used in CI pipeline?
@srmagura
Great summary thanks for the article. Just one more to add to the list csharpier.com it's similar to dotnet format except does the things you highlighted are missing.
Rider is worth checking out. Most of the developers at my company have switched to rider. The only thing we still need VS for is fixing binding redirects in old net framework code.