Skip to content

Commit b06e08b

Browse files
authored
Update our tools to run on >NET 8 (dotnet#996)
* Upgrade .NET and NuGet packages There were some breaking changes in the Word Converter packages. The only source code changes were to address the Word converter source breaks. * interim checkin. Revert to 4.1.0 * Remove unnecessary usings, filespace using Review this diff by hiding whitespace. First, remove all unnecessary usings. Second, convert all namespace declarations to file scoped namespaces. * add editorconfig This one is consistent with the version on dotnet/docs. We can season to taste as we're ready. * Use the .NET 8 SDK for all our tools. * Revert the grammar validator to .net 6 I've got a PR in that repo to update it. Once approved, I'll install the NuGet package here, and update that YML file. * respond to review comments - Update Roslyn packages to 4.8 - Remove coverlet - Formatting in csproj.
1 parent 720d921 commit b06e08b

39 files changed

+2550
-2408
lines changed

.github/workflows/renumber-sections.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
- name: Check out our repo
2222
uses: actions/checkout@v2
2323

24-
- name: Setup .NET 6.0
24+
- name: Setup .NET 8.0
2525
uses: actions/setup-dotnet@v1
2626
with:
27-
dotnet-version: 6.0.x
27+
dotnet-version: 8.0.x
2828

2929
- name: Run section renumbering dry run
3030
run: |

.github/workflows/smart-quotes.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ jobs:
2424
- name: Check out our repo
2525
uses: actions/checkout@v2
2626

27-
- name: Setup .NET 6.0
27+
- name: Setup .NET 8.0
2828
uses: actions/setup-dotnet@v1
2929
with:
30-
dotnet-version: 6.0.x
30+
dotnet-version: 8.0.x
3131

3232
- name: Smarten quotes
3333
id: smarten-quote

.github/workflows/test-examples.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ jobs:
2323
- name: Check out our repo
2424
uses: actions/checkout@v2
2525

26-
- name: Setup .NET 6.0
26+
- name: Setup .NET 8.0
2727
uses: actions/setup-dotnet@v1
2828
with:
29-
dotnet-version: 6.0.x
29+
dotnet-version: 8.0.x
3030

3131
- name: Extract and validate tests
3232
run: |

.github/workflows/tools-tests.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ jobs:
2525
- name: Check out our repo
2626
uses: actions/checkout@v2
2727

28-
- name: Setup .NET 6.0
28+
- name: Setup .NET 8.0
2929
uses: actions/setup-dotnet@v1
3030
with:
31-
dotnet-version: 6.0.x
31+
dotnet-version: 8.0.x
3232

3333
- name: Run all tests
3434
run: |

.github/workflows/update-on-merge.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ jobs:
2929
- name: Check out our repo
3030
uses: actions/checkout@v2
3131

32-
- name: Setup .NET 6.0
32+
- name: Setup .NET 8.0
3333
uses: actions/setup-dotnet@v1
3434
with:
35-
dotnet-version: 6.0.x
35+
dotnet-version: 8.0.x
3636

3737
- name: Set up JDK 15
3838
uses: actions/setup-java@v1

.github/workflows/word-converter.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
- name: Check out our repo
2222
uses: actions/checkout@v2
2323

24-
- name: Setup .NET 6.0
24+
- name: Setup .NET 8.0
2525
uses: actions/setup-dotnet@v1
2626
with:
27-
dotnet-version: 6.0.x
27+
dotnet-version: 8.0.x
2828

2929
- name: Run converter
3030
run: |

tools/.editorconfig

+210
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
# editorconfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Default settings:
7+
# A newline ending every file
8+
# Use 4 spaces as indentation
9+
[*]
10+
insert_final_newline = true
11+
indent_style = space
12+
indent_size = 4
13+
trim_trailing_whitespace = true
14+
15+
[project.json]
16+
indent_size = 2
17+
18+
# C# and Visual Basic files
19+
[*.{cs,vb}]
20+
charset = utf-8-bom
21+
22+
# Analyzers
23+
dotnet_analyzer_diagnostic.category-Security.severity = error
24+
dotnet_code_quality.ca1802.api_surface = private, internal
25+
26+
# Miscellaneous style rules
27+
dotnet_sort_system_directives_first = true
28+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
29+
dotnet_style_predefined_type_for_member_access = true:suggestion
30+
31+
# avoid this. unless absolutely necessary
32+
dotnet_style_qualification_for_field = false:suggestion
33+
dotnet_style_qualification_for_property = false:suggestion
34+
dotnet_style_qualification_for_method = false:suggestion
35+
dotnet_style_qualification_for_event = false:suggestion
36+
37+
# name all constant fields using PascalCase
38+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
39+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
40+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
41+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
42+
dotnet_naming_symbols.constant_fields.required_modifiers = const
43+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
44+
45+
# static fields should have s_ prefix
46+
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
47+
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
48+
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
49+
dotnet_naming_symbols.static_fields.applicable_kinds = field
50+
dotnet_naming_symbols.static_fields.required_modifiers = static
51+
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
52+
dotnet_naming_style.static_prefix_style.required_prefix = s_
53+
dotnet_naming_style.static_prefix_style.capitalization = camel_case
54+
55+
# internal and private fields should be _camelCase
56+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
57+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
58+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
59+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
60+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
61+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
62+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
63+
64+
# Code quality
65+
dotnet_style_readonly_field = true:suggestion
66+
dotnet_code_quality_unused_parameters = non_public:suggestion
67+
68+
# Expression-level preferences
69+
dotnet_style_object_initializer = true:suggestion
70+
dotnet_style_collection_initializer = true:suggestion
71+
dotnet_style_explicit_tuple_names = true:suggestion
72+
dotnet_style_coalesce_expression = true:suggestion
73+
dotnet_style_null_propagation = true:suggestion
74+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
75+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
76+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
77+
dotnet_style_prefer_auto_properties = true:suggestion
78+
dotnet_style_prefer_conditional_expression_over_assignment = true:refactoring
79+
dotnet_style_prefer_conditional_expression_over_return = true:refactoring
80+
81+
# CA2208: Instantiate argument exceptions correctly
82+
dotnet_diagnostic.CA2208.severity = error
83+
84+
# C# files
85+
[*.cs]
86+
# New line preferences
87+
csharp_new_line_before_open_brace = all
88+
csharp_new_line_before_else = true
89+
csharp_new_line_before_catch = true
90+
csharp_new_line_before_finally = true
91+
csharp_new_line_before_members_in_object_initializers = true
92+
csharp_new_line_before_members_in_anonymous_types = true
93+
csharp_new_line_between_query_expression_clauses = true
94+
95+
# Indentation preferences
96+
csharp_indent_block_contents = true
97+
csharp_indent_braces = false
98+
csharp_indent_case_contents = true
99+
csharp_indent_case_contents_when_block = true
100+
csharp_indent_switch_labels = true
101+
csharp_indent_labels = one_less_than_current
102+
103+
# Modifier preferences
104+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
105+
106+
# Code style defaults
107+
csharp_using_directive_placement = outside_namespace:suggestion
108+
csharp_prefer_braces = true:refactoring
109+
csharp_preserve_single_line_blocks = true:none
110+
csharp_preserve_single_line_statements = false:none
111+
csharp_prefer_static_local_function = true:suggestion
112+
csharp_prefer_simple_using_statement = false:none
113+
csharp_style_prefer_switch_expression = true:suggestion
114+
115+
# Expression-bodied members
116+
csharp_style_expression_bodied_methods = true:refactoring
117+
csharp_style_expression_bodied_constructors = true:refactoring
118+
csharp_style_expression_bodied_operators = true:refactoring
119+
csharp_style_expression_bodied_properties = true:refactoring
120+
csharp_style_expression_bodied_indexers = true:refactoring
121+
csharp_style_expression_bodied_accessors = true:refactoring
122+
csharp_style_expression_bodied_lambdas = true:refactoring
123+
csharp_style_expression_bodied_local_functions = true:refactoring
124+
125+
# Pattern matching
126+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
127+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
128+
csharp_style_inlined_variable_declaration = true:suggestion
129+
130+
# Expression-level preferences
131+
csharp_prefer_simple_default_expression = true:suggestion
132+
133+
# Null checking preferences
134+
csharp_style_throw_expression = true:suggestion
135+
csharp_style_conditional_delegate_call = true:suggestion
136+
137+
# Other features
138+
csharp_style_prefer_index_operator = false:none
139+
csharp_style_prefer_range_operator = false:none
140+
csharp_style_pattern_local_over_anonymous_function = false:none
141+
142+
# Space preferences
143+
csharp_space_after_cast = false
144+
csharp_space_after_colon_in_inheritance_clause = true
145+
csharp_space_after_comma = true
146+
csharp_space_after_dot = false
147+
csharp_space_after_keywords_in_control_flow_statements = true
148+
csharp_space_after_semicolon_in_for_statement = true
149+
csharp_space_around_binary_operators = before_and_after
150+
csharp_space_around_declaration_statements = do_not_ignore
151+
csharp_space_before_colon_in_inheritance_clause = true
152+
csharp_space_before_comma = false
153+
csharp_space_before_dot = false
154+
csharp_space_before_open_square_brackets = false
155+
csharp_space_before_semicolon_in_for_statement = false
156+
csharp_space_between_empty_square_brackets = false
157+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
158+
csharp_space_between_method_call_name_and_opening_parenthesis = false
159+
csharp_space_between_method_call_parameter_list_parentheses = false
160+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
161+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
162+
csharp_space_between_method_declaration_parameter_list_parentheses = false
163+
csharp_space_between_parentheses = false
164+
csharp_space_between_square_brackets = false
165+
166+
# Namespace preference
167+
csharp_style_namespace_declarations = file_scoped:suggestion
168+
169+
# Types: use keywords instead of BCL types, and permit var only when the type is clear
170+
csharp_style_var_for_built_in_types = false:suggestion
171+
csharp_style_var_when_type_is_apparent = false:none
172+
csharp_style_var_elsewhere = false:suggestion
173+
174+
# Visual Basic files
175+
[*.vb]
176+
# Modifier preferences
177+
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion
178+
179+
# C++ Files
180+
[*.{cpp,h,in}]
181+
curly_bracket_next_line = true
182+
indent_brace_style = Allman
183+
184+
# Xml project files
185+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
186+
indent_size = 2
187+
188+
# Xml build files
189+
[*.builds]
190+
indent_size = 2
191+
192+
# Xml files
193+
[*.{xml,stylecop,resx,ruleset}]
194+
indent_size = 2
195+
196+
# Xml config files
197+
[*.{props,targets,config,nuspec}]
198+
indent_size = 2
199+
200+
# Shell scripts
201+
[*.sh]
202+
end_of_line = lf
203+
204+
[*.{cmd, bat}]
205+
end_of_line = crlf
206+
207+
# Markdown files
208+
[*.md]
209+
# Double trailing spaces can be used for BR tags, and other instances are enforced by Markdownlint
210+
trim_trailing_whitespace = false

tools/ExampleExtractor/ExampleExtractor.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
11+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1212
</ItemGroup>
1313

1414
</Project>

tools/ExampleFormatter/ExampleFormatter.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
11+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1212
<ProjectReference Include="..\ExampleExtractor\ExampleExtractor.csproj" />
1313
</ItemGroup>
1414

tools/ExampleTester/ExampleTester.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.Build.Locator" Version="1.5.5" />
12-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.0" />
13-
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.3.0" />
11+
<PackageReference Include="Microsoft.Build.Locator" Version="1.6.10" />
12+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.8.0" />
13+
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.8.0" />
1414
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
1515
</ItemGroup>
1616

tools/ExampleTester/TesterConfiguration.cs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.CommandLine;
22
using System.CommandLine.Binding;
3-
using System.CommandLine.Invocation;
43

54
namespace ExampleTester;
65

tools/MarkdownConverter.Tests/MarkdownConverter.Tests.csproj

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<Nullable>enable</Nullable>
6-
6+
<ImplicitUsings>enable</ImplicitUsings>
77
<IsPackable>false</IsPackable>
88
</PropertyGroup>
99

@@ -13,14 +13,10 @@
1313
</ItemGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
17-
<PackageReference Include="XMLUnit.Core" Version="2.9.1" />
18-
<PackageReference Include="xunit" Version="2.4.1" />
19-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
20-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
21-
<PrivateAssets>all</PrivateAssets>
22-
</PackageReference>
23-
<PackageReference Include="coverlet.collector" Version="3.1.0">
16+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
17+
<PackageReference Include="XMLUnit.Core" Version="2.9.2" />
18+
<PackageReference Include="xunit" Version="2.6.2" />
19+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
2420
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2521
<PrivateAssets>all</PrivateAssets>
2622
</PackageReference>

0 commit comments

Comments
 (0)