How to get rid of Naming rule violation messages in Visual Studio?

Solution 1:

Its a new configurable feature, if you go to

Tools → Options → Text Editor → Your language (I did C#) → Code Style → Naming

In there I went to Manage Styles add camel Case (its in there but you need to add it to your selectable): go to the "+" sign, then add your rule accordingly.

Important: Close your solution and re-open it for changes to take effect.

For example, I only use camel Case for private methods. So I choose Private Method and required Style the new one I created "camel Case" and set it to Severity Suggestion (I also promoted it to the top).

The built in are all "Suggestions" too so you can also just turn off Messages.

Solution 2:

If you want to suppress it only in some files or areas you can use the following:

#pragma warning disable IDE1006

// the code with the warning

#pragma warning restore IDE1006

Solution 3:

If you need to get rid of these messages you could also just suppress them.

enter image description here

Solution 4:

You could rename the method and add the name to the attribute with the EntryPoint property.

[System.Runtime.InteropServices.DllImport("swedll32.dll", EntryPoint = "swe_calc")]
public static extern Int32 SweCalc(double tjd, int ipl, Int32 iflag, IntPtr xx, IntPtr serr);