visual studio 2010 inserts using directives inside namespace

1.8k views Asked by At

I have exactly opposite problem to one described here. In my case Visual Studio inserts using directives inside namespace and I want to prevent this. I did try to uncheck Resharper option: Languages -> C# -> Formatting Style -> Namespace Imports -> Add using directive to the deepest scope And it didn't help. Also I tried to temporary disable the Resharper. Still same issue. Btw, I have StyleCop and StyleCop+ installed as well. Maybe it is causing the issue. So right now when I go and Add New Item -> Class - it will create new code file with using directives inside namespace. How to change this?

1

There are 1 answers

2
Nicole Calinoiu On BEST ANSWER

Have you replace your class template file with one that has one or more using directives inside the namespace declaration? If so, you're probably seeing the result of an interesting bit of C# plugin behavior: a newly added using directive is placed after the last recognized using directly already in the file, regardless of where that is.