How (supposing it\'s even possible) to turn off the Visual Studio 2015 feature to gray out unused usings (usings in C#, Imports in VB) ?? I like all the other highlight / s
You can disable it on a project-by-project basis. Open your project references > Analyzers and turn off IDE0005
. This will disable the 'visual cue' (grayed out hint) but you will still be able to select the quick action 'Remove unnecessary usings' if you put the cursor on one of these. Don't think it's possible to disable this (and you really shouldn't anyway).
If the unused using
is actually useful (i.e. shortens names of types in documentation comments when you pause your mouse over a member outside debug mode). You can suppress the warning for those usings with #pragma warning disable
:
#pragma warning disable IDE0005 // Using directive is unnecessary
To resume the behavior in the file, you would use #pragma warning restore
.
#pragma warning restore IDE0005 // Using directive is unnecessary
Do be warned, as of VS 2017 15.6.6, the menu option for Remove and Sort Usings
will ignore the #pragma warning disable
directives. As I think this is a bug, I will be submitting a roslyn issue.