Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Properly remove StyleCop R# plugin

I installed StyleCop and the associated plugin for ReSharper 5. After getting annoyed with it I removed both the plugin and StyleCop, but ReSharper is still using some of the StyleCop behaviour - most notably moving using statements to within the namespace declaration, rather than keeping them outside the declaration.

For instance say you have the following source:

using System;
using System.Web;

namespace Foo.Bar
{
    ////
}

And the file sits within The Foo/Bar/Widget directory, using ReSharper's fix namespace tool I would expect the file to stay the same, but the namespace to have changed to Foo.Bar.Widgets (this is the behaviour it exhibited before StyleCop came along).

Now however it rearranges the file:

namespace Foo.Bar.Widget
{
    using System;
    using System.Web;

    ////
}

Now putting aside people's personal preferences about which one is better, I don't like it, and it is inconsistent with our existing code. Having to manually move using statements after renaming the namespace takes long than renaming the namespace manually.

Does anyone know how to correct this (I'm assuming there is a file or something still lingering around from the install, or a config that hasn't been reverted).

like image 274
Michael Shimmins Avatar asked Apr 23 '11 00:04

Michael Shimmins


2 Answers

You can change it here:

ReSharper -> Options -> Languages -> C# -> Namespace Imports -> Add using directive to the deepest scope

UPDATE - Resharper 9 This option is now moved to:

ReSharper -> Options -> Code Editing -> C# -> Code Style -> Reference qualification

like image 193
Teoman Soygul Avatar answered Oct 17 '22 18:10

Teoman Soygul


I just had the same issue. It turns out that the StyleCop settings are stored in the "This computer" layer of ReSharper settings. See ReSharper > Manage Options for a list of layers.

I just had to reset the "This computer" layer; this was possible since I had never intentionally modified it.

like image 23
sferencik Avatar answered Oct 17 '22 17:10

sferencik