I use ReSharper to format code and StyleCop for code analyses, and I use rule SA1210:UsingDirectivesMustBeOrderedAlphabeticallyByNames
.
Everything was fine until StructureMap
and log4net
met in the same file: ReSharper sorts them case-sensitively:
using StructureMap;
using log4net;
But StyleCop checks them case-insensitively:
error : SA1210: Using directives must be sorted alphabetically by the namespaces.
I don't want to turn off rule. I wouldn't use StyleCop plugin for ReSharper as it proved to be unstable in my environment and slows machine a lot.
How can I make them work together?
You could alias the log4net using statement:
using Log4Net = log4net;
namespace ClassLibrary1
{
public class Class1
{
private Log4Net.ILog log;
public Class1()
{
log = Log4Net.LogManager.GetLogger(typeof (Class1));
log.Debug("msg");
}
}
}