c# - Visual Studio 2012 给出了荒谬的错误

标签 c# asp.net visual-studio asp.net-mvc-4 visual-studio-2012

如果出现以下任何错误,我的 visual studio 不会构建解决方案:

1. Invalid spacing around ';'
2. All private methods must be declared after protected.
3. Constructor must be placed before method declarations.
4. Must use curly brackets in if condition.
5. Use string.empty instead of "".

现在我知道我们应该遵循正确的编码习惯,但我正在处理包含这些内容的旧代码。很难更改每个文件。我怎样才能阻止 VS 给出这些类型的错误?

最佳答案

您似乎在不合规的解决方案上使用 Stylecop。 在包含 *.sln 文件的目录中创建一个设置文件“Settings.StyleCop”。 将以下内容添加到文件中:

<StyleCopSettings Version="105">
  <GlobalSettings>
    <BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
  </GlobalSettings>
</StyleCopSettings>

关于c# - Visual Studio 2012 给出了荒谬的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26800614/

相关文章:

c# - System.Web.HttpRequestValidationException : A potentially dangerous Request. 从机器人客户端检测到表单值?

windows - 在代码管理菜单中恢复visual studio code中删除的文件

c# - Asp.net MVC ViewEngineResult + 嵌入式 View

c# - 如何生成一个随机字符串,并指定你想要的长度,或者更好地生成你想要的规范的唯一字符串

c# - 从 MVC Controller 调用 AWS Lambda 函数

asp.net - 当用户未在asp.net中进行身份验证时,如何在登录页面中显示图像?

c# - 如何在不属于任何选项卡内容(即登录部分或注册部分)的 JQuery 选项卡上延迟加载内容

c# - string.Equals() 和 == 运算符真的一样吗?

c++ - 如何将本地文件嵌入到从 C++ 项目生成的 exe 文件中?

c++ - Visual Studio 在此选择排序上抛出大量调试错误