Search code examples
visual-studionamespacesresharpernamingstylecop

Namespace naming convention when [CompanyName] starts with a lower case "i"


My company name starts with a lower case "i". For example: iWare (this is not the real company name, but it demonstrates the purposes).

Because of this I find that I am constantly having to fight StyleCop and Resharper due to the namespace naming rules / conventions.

Does anyone have any ideas how should I be naming my namespaces (and sometimes classes).

EG.

namespace iWare.Product.X
{
    ...
}

As you can imagine, most of the tools shown above do not like this. Are there any suggestions as to what an alternative should be? I have tried suppressing the error using the following:

[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:ElementMustBeginWithUpperCaseLetter", Justification = "Reviewed. Suppression is OK here.")]
namespace iWare.Product.X
{
    ...
}

But, this results in the following error: A namespace declaration cannot have modifiers or attributes

Any ideas?


Solution

  • it seems like you're using iWare, or your company name, as your root namespace.

    On my projects, I generally specify my root namespace in/using the property window of MyProject, or MenuItem 'Project' > 'Properties' > 'Application' - 'root namespace' textbox on right.

    Thus, I don't specify it in my coding at all, unless I'm referencing it from another component/project as an import.