如何摆脱Visual Studio中的命名规则冲突消息? [英] How to get rid of Naming rule violation messages in Visual Studio?

查看:1265
本文介绍了如何摆脱Visual Studio中的命名规则冲突消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了Visual Studio2017.打开现有网站时,会收到各种警告消息,例如:

I just installed Visual Studio 2017. When I open an existing website, I get all sorts of warning messages such as this one:

IDE1006违反命名规则:这些词必须以大写字母开头 字符:swe_calc

IDE1006 Naming rule violation: These words must begin with upper case characters: swe_calc

在代码中,其定义为:

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

这也发生在我的ASP.Net控件中.作为一个DropDownList的示例:

This also occurs with my ASP.Net controls. As an example of a DropDownList:

IDE1006违反命名规则:这些词必须以大写字母开头 字符:ddlMonth_SelectedIndexChanged

IDE1006 Naming rule violation: These words must begin with upper case characters: ddlMonth_SelectedIndexChanged

如何在Visual Studio中消除这些类型的警告?

How can I eliminate these type of warnings under Visual Studio?

推荐答案

如果转到

选项→文本编辑器→您的语言(我使用C#)→代码样式→命名

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.

这篇关于如何摆脱Visual Studio中的命名规则冲突消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆