Question

The organize usings option in Visual Studio 2013 doesn't match the style cop rule SA1208. For example:

The Organize usings would put them in:

Namespace.Entities;
Namespace.Interfaces;
System;
System.Linq;

But SA108 requires the system ones first.

System;
System.Linq;
Namespace.Entities;
Namespace.Interfaces;

Is there a way to make visual studio behavior match the StyleCop rule?

Was it helpful?

Solution

By default, my Visual Studio installation already sorts System usings first.

But you can change it. See here (check the note).

Go to Tools -> Options -> C# (I assume you are working on a C# project) -> Advanced. Then check the box saying "Place 'System' directives first when sorting usings"

EDIT: For recent versions, MS moved the documentation to a different page: see here (check the Organize usings section).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top