简体   繁体   中英

Visual Studio 2012 gives ridiculous errors

My visual studio doesn't build the solution if any of the following errors occurs:

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 "".

Now I know we should follow correct coding practice, but I'm working on an old code that has these kinds of things. Its hard to change each and every file. How can I stop VS from giving these kinds of errors?

Seems you're using Stylecop on a non-compliant solution. Create a setting file 'Settings.StyleCop' in the directory containing the *.sln file. Add the following contents to the file:

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

This is either caused by a plugin like Resharper or StyleCop. You can turn off some of these warnings or disable the plugin completely.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM