Show unnecessary imports in the Visual Studio's error window
I don't like having extra imports in files. By default, Visual Studio shows them as faded and provide a quick fix to remove them:
In this case, you need to check in each file whether all imports are used. It is possible to show them in the error window:
Create a new file named .editorconfig
at the root of your project with the following content:
.editorconfig
[*.{cs,vb}]
# IDE0002: Name can be simplified
dotnet_diagnostic.IDE0002.severity = suggestion
# IDE0005: Remove unnecessary imports
dotnet_diagnostic.IDE0005.severity = suggestion
Also, you need to configure Visual Studio to analyze the entire solution:
Note that you can change the severity of any IDE0000
rule by editing the .editorconfig
file.
Do you have a question or a suggestion about this post? Contact me!
Enjoy this blog?💖 Sponsor on GitHub