Domanda

I have set up a new MVC 4 web application. I am currently running source code anaylsis against the project and getting the following error:

CA1707  Identifiers should not contain underscores

The reason for this is because of the namespace "App_Start" due to the App_Start folder name. Are there any issues with renaming the folder to "AppStart"? This will mean all my rules are passed.

È stato utile?

Soluzione

I would suppress that rule for that particular namespace rather than rename it. Create a GlobalSuppressions.cs file in your web project root, and add this:

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("Microsoft.Naming",
                           "CA1707:IdentifiersShouldNotContainUnderscores",
                           Scope = "namespace",
                           Target = "<namespace>.App_Start",
                           Justification = "This is an infrastructure namespace")]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top