如果出现以下任何错误,我的 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/