Domanda

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?

È stato utile?

Soluzione

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).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top