1+ root = true
2+
3+ # Don't use tabs for indentation.
4+ [* ]
5+ indent_style = space
6+
7+ # Code files
8+ [* .{cs, csx, vb, vbx} ]
9+ indent_size = 4
10+ insert_final_newline = true
11+ charset = utf-8-bom
12+
13+ # Xml project files
14+ [* .{csproj, vbproj, vcxproj, vcxproj.filters, proj, projitems, shproj} ]
15+ indent_size = 2
16+
17+ # Xml config files
18+ [* .{props, targets, ruleset, config, nuspec, resx, vsixmanifest, vsct} ]
19+ indent_size = 2
20+
21+ # JSON files
22+ [* .json ]
23+ indent_size = 2
24+
25+ # Dotnet code style settings:
26+ [* .{cs, vb} ]
27+ dotnet_style_prefer_is_null_check_over_reference_equality_method = true :silent
28+ dotnet_style_prefer_simplified_boolean_expressions = true :silent
29+ dotnet_style_prefer_simplified_interpolation = true :silent
30+ dotnet_style_readonly_field = true :suggestion
31+
32+ # Sort using and Import directives with System.* appearing first
33+ dotnet_sort_system_directives_first = true
34+ dotnet_separate_import_directive_groups = false
35+ # Avoid "this." and "Me." if not necessary
36+ dotnet_style_qualification_for_field = false :suggestion
37+ dotnet_style_qualification_for_property = false :suggestion
38+ dotnet_style_qualification_for_method = false :suggestion
39+ dotnet_style_qualification_for_event = false :suggestion
40+
41+ # Auto-properties
42+ dotnet_style_prefer_auto_properties = true :silent
43+ dotnet_style_prefer_conditional_expression_over_return = true
44+
45+ # Tuples
46+ dotnet_style_prefer_inferred_tuple_names = true :suggestion
47+
48+ # Use language keywords instead of framework type names for type references
49+ dotnet_style_predefined_type_for_locals_parameters_members = true :suggestion
50+ dotnet_style_predefined_type_for_member_access = true :suggestion
51+
52+ # Suggest more modern language features when available
53+ dotnet_style_object_initializer = true :suggestion
54+ dotnet_style_collection_initializer = true :suggestion
55+ dotnet_style_coalesce_expression = true :suggestion
56+ dotnet_style_null_propagation = true :suggestion
57+ dotnet_style_explicit_tuple_names = true :suggestion
58+
59+ # internal and private fields should be _camelCase
60+ dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning
61+ dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
62+ dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
63+
64+ dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
65+ dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
66+ dotnet_naming_style.camel_case_underscore_style.required_prefix = _
67+ dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
68+
69+ # name all constant fields using UpperCase
70+ dotnet_naming_rule.constant_fields_should_be_upper_case.severity = warning
71+ dotnet_naming_rule.constant_fields_should_be_upper_case.symbols = constant_fields
72+ dotnet_naming_rule.constant_fields_should_be_upper_case.style = upper_case_style
73+
74+ dotnet_naming_symbols.constant_fields.applicable_kinds = field
75+ dotnet_naming_symbols.constant_fields.required_modifiers = const
76+ dotnet_naming_style.upper_case_style.capitalization = all_upper
77+
78+ # CSharp code style settings:
79+ [* .cs ]
80+ # Prefer "var" everywhere
81+ csharp_style_var_for_built_in_types = true :suggestion
82+ csharp_style_var_when_type_is_apparent = true :suggestion
83+ csharp_style_var_elsewhere = true :suggestion
84+
85+ # Prefer method-like constructs to have a block body
86+ csharp_style_expression_bodied_methods = false :none
87+ csharp_style_expression_bodied_constructors = false :none
88+ csharp_style_expression_bodied_operators = false :none
89+
90+ # Prefer property-like constructs to have an expression-body
91+ csharp_style_expression_bodied_properties = true :none
92+ csharp_style_expression_bodied_indexers = true :none
93+ csharp_style_expression_bodied_accessors = true :none
94+
95+ # Suggest more modern language features when available
96+ csharp_style_pattern_matching_over_is_with_cast_check = true :suggestion
97+ csharp_style_pattern_matching_over_as_with_null_check = true :suggestion
98+ csharp_style_inlined_variable_declaration = true :suggestion
99+ csharp_style_throw_expression = true :suggestion
100+ csharp_style_conditional_delegate_call = true :suggestion
101+
102+ # Order
103+ csharp_preferred_modifier_order = public, private, protected, internal, static, extern, new, virtual, abstract, sealed, override, readonly, unsafe, volatile, async:suggestion
104+
105+ # Newline settings
106+ csharp_new_line_before_open_brace = all
107+ csharp_new_line_before_else = true
108+ csharp_new_line_before_catch = true
109+ csharp_new_line_before_finally = true
110+ csharp_new_line_before_members_in_object_initializers = true
111+ csharp_new_line_before_members_in_anonymous_types = true
112+
113+ # Resharper
114+ resharper_csharp_keep_existing_attribute_arrangement = true
115+ resharper_csharp_braces_for_ifelse = required
116+ resharper_csharp_place_simple_anonymousmethod_on_single_line = true
117+ resharper_csharp_keep_existing_arrangement = true
118+
119+ # Nullable error
120+ dotnet_diagnostic.CS8601.severity = error
121+ dotnet_diagnostic.CS8604.severity = error
122+ dotnet_diagnostic.CS8618.severity = error
0 commit comments