41 lines
2.7 KiB
Markdown
41 lines
2.7 KiB
Markdown
|
|
# .NET
|
||
|
|
|
||
|
|
These are the configuration files for .NET projects or solutions.
|
||
|
|
|
||
|
|
You can copy these files into the root of your .NET solution in order to activate the conventions.
|
||
|
|
|
||
|
|
### directory.build.props
|
||
|
|
|
||
|
|
The `directory.build.props` contains important project configuration, that need to be set for all .NET projects in your solution. It will set some global compiler configuration and the static analyzers get imported via NuGet.
|
||
|
|
|
||
|
|
### .editorconfig
|
||
|
|
|
||
|
|
The `.editorconfig` contains configuration for your code editor and the ruleset of the static analyzers. Copy this file into the root of you repository so that it is active for all files and folders.
|
||
|
|
|
||
|
|
#### Analyzers
|
||
|
|
|
||
|
|
| Name | Version | NuGet |
|
||
|
|
|--------------------------------------------|----------------|--------------------------------------------------------------------------------------------|
|
||
|
|
| Microsoft.CodeAnalysis.NetAnalyzers | 8.0.0 | [NuGet](https://www.nuget.org/packages/Microsoft.CodeAnalysis.NetAnalyzers/8.0.0) |
|
||
|
|
| Microsoft.VisualStudio.Threading.Analyzers | 17.8.14 | [NuGet](https://www.nuget.org/packages/Microsoft.VisualStudio.Threading.Analyzers/17.8.14) |
|
||
|
|
| Roslynator.Analyzers | 4.6.2 | [NuGet](https://www.nuget.org/packages/Roslynator.Analyzers/4.6.2) |
|
||
|
|
| Roslynator.CodeAnalysis.Analyzers | 4.6.2 | [NuGet](https://www.nuget.org/packages/Roslynator.CodeAnalysis.Analyzers/4.6.2) |
|
||
|
|
| Roslynator.Formatting.Analyzers | 4.6.2 | [NuGet](https://www.nuget.org/packages/Roslynator.Formatting.Analyzers/4.6.2) |
|
||
|
|
| StyleCop.Analyzers | 1.2.0-beta.556 | [NuGet](https://www.nuget.org/packages/StyleCop.Analyzers/1.2.0-beta.556) |
|
||
|
|
|
||
|
|
#### Priority
|
||
|
|
|
||
|
|
The analyzers are handled with priority. That means, that a violation of a rule from an analyzer with a higher priority overrides a violation of a lower priority analyzer. In case of conflicting rules from different analyzers, the rule from the analyzer with the lower priority gets changed or deactivated.
|
||
|
|
|
||
|
|
Priority of analyzers:
|
||
|
|
|
||
|
|
1. Microsoft.CodeAnalysis.NetAnalyzers
|
||
|
|
2. Microsoft.VisualStudio.Threading.Analyzers
|
||
|
|
3. StyleCop.Analyzers
|
||
|
|
4. Roslynator.Analyzers
|
||
|
|
5. Roslynator.CodeAnalysis.Analyzers
|
||
|
|
6. Roslynator.Formatting.Analyzers
|
||
|
|
|
||
|
|
### stylecop.json
|
||
|
|
|
||
|
|
The `stylecop.json` contains the configuration for "StyleCop.Analyzers", that cannot be set via the `.editorconfig`. This file must be copied into the root of your repository as it gets imported from there into all .NET projects by the `directory.build.props`.
|