Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set ReSharper to put the 'using' import outside the namespace

I've ReSharper v9.0 installed on my VS. I also use StyleCop. I've disabled SA1200, so when I put the using statements outside the namespace, I don't get warned again. But when I add a reference via [alt]+[enter], which isn't available in using statements, R# put it inside the namespace. Of course, it is not consistent right, R# should place it outside the namespace.

I've tried to reset R# setting to factory default, it works as I expected. But when I apply StyleCop rules again, this problem happen again. How should I setup this?

like image 489
iroel Avatar asked Mar 06 '15 16:03

iroel


People also ask

Should using directives be inside or outside the namespace?

As a rule, external using directives (System and Microsoft namespaces for example) should be placed outside the namespace directive. They are defaults that should be applied in all cases unless otherwise specified.

How do I import a namespace?

To add an imported namespaceIn Solution Explorer, double-click the My Project node for the project. In the Project Designer, click the References tab. In the Imported Namespaces list, select the check box for the namespace that you wish to add. In order to be imported, the namespace must be in a referenced component.


1 Answers

Answer from another question:

UPDATE - Resharper 9: This option is now moved to Code Editing -> C# -> Code Style https://stackoverflow.com/a/825256/67420

like image 71
Jozef Izso Avatar answered Sep 26 '22 03:09

Jozef Izso