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?
Asked
Active
Viewed 1,827 times
2
1 Answers
2
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.

Nicole Calinoiu
- 20,843
- 2
- 44
- 49
-
Where can I find the template for class file? – Serhiy Aug 02 '13 at 09:09
-
The default location for the class template is under `
\Common7\IDE\ItemTemplates\CSharp\Code\1033`. If you do change the class template, you will likely need to force Visual Studio to refresh its template cache as described at http://msdn.microsoft.com/en-us/library/vstudio/ms241279(v=vs.100).aspx. – Nicole Calinoiu Aug 02 '13 at 12:11