Can you disable styleCop in VS?
Scenario:
By default, JetBrains Rider does not read settings from StyleCop files (RuleSet and Settings. StyleCop). To start taking these settings into account, select the Enable StyleCop support checkbox on the Editor | Code Style page of JetBrains Rider settings Ctrl+Alt+S and choose which StyleCop file format should be used.
Starting with StyleCop 4.3. 2, it is possible to suppress the reporting of rule violations by adding suppression attributes within the source code. The syntax for these suppressions is similar to that for Visual Studio Code Analysis, or FxCop.
You can disbale StyleCop for the entire solution by placing a Settings.StyleCop in the root of your solution folder, with the following contents:
<StyleCopSettings Version="105">
<GlobalSettings>
<BooleanProperty Name="RulesEnabledByDefault">False</BooleanProperty>
</GlobalSettings>
</StyleCopSettings>
You'll need to restart Visual Studio after doing so.
I've setup a separate build configuration that doesn't run code analysis.
I now have the following configurations in VS:
You have to manually choose which configuration you want to build (i.e. step 3 in your list would be a manual step)
In the build targets file I've included code along these lines:
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug (No code analysis)' ">
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup>
<DefineConstants Condition="('$(RunCodeAnalysis)'=='true') and '$(Language)'=='C#' ">CODE_ANALYSIS;$(DefineConstants)</DefineConstants>
</PropertyGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With