Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I Disable Lightbulb for Fully Qualified Usings in Visual Studio 2015?

I have:

namespace My.Namespace.Admin.Presenter
{
    using System;
    using System.Collections.Specialized;
    using System.Globalization;

    using My.Framework.Utility;
    using My.Namespace.Core.Business.Admin;
    using My.Namespace.Core.Entities.Admin;

    ...
}

In Visual Studio 2015, this is flagged as an improvement by the lightbulb IDE0001: Name Can by Simplified for

  • My.Framework.Utility to Framework.Utility
  • My.Namespace.Core.Business.Admin to Core.Business.Admin
  • My.Namespace.Core.Entities.Admin to Core.Entities.Admin

I don't like the lighbulbs suggestion, how can I turn it off? There doesn't seem to be a global setting for these and clicking the IDE0001 error just performs a bing search rather than a dedicated help page.

This question deals with another issue flagged by IDE0001, but not the namespacing.

like image 290
NikolaiDante Avatar asked Jul 24 '15 09:07

NikolaiDante


1 Answers

This can be achieved via creating a Code Analysis Ruleset

In project properties select the Code Analysis tab - enter image description here

Then edit a ruleset. The IDE* rules are under the Analyzer Microsoft.CodeAnalysis.CSharp.Features:

enter image description here

Change IDE0001 to none (or all of them to none), and the rule isn't fired anymore.

It's not granular enough to only get rid of the namespace IDE0001, but does get rid of it along with the rest of IDE0001 "suggestions" which is good enough for my needs.

The created Ruleset can be applied to all projects as needed.

like image 130
NikolaiDante Avatar answered Nov 10 '22 11:11

NikolaiDante