From 1cd981262216aef498fd151b78bbe2551ae7a98d Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Tue, 11 Aug 2026 12:26:58 -0400 Subject: [PATCH 1/4] Update all projects For C# 13, use the .NET 9 target framework, and remove the LangVersion tags. --- .../FastCsprojCompilationParserTests.cs | 14 +++++++------- .../code-in-class-lib-without-using/Project.csproj | 3 +-- .../code-in-class-lib/Project.csproj | 3 +-- .../code-in-main-without-using/Project.csproj | 3 +-- .../example-templates/code-in-main/Project.csproj | 3 +-- .../code-in-partial-class/Project.csproj | 3 +-- .../extern-lib/ExampleProject.csproj | 3 +-- tools/example-templates/extern-lib/ExternN2.csproj | 3 +-- tools/example-templates/extern-lib/ExternR1.csproj | 3 +-- tools/example-templates/extern-lib/ExternX.csproj | 3 +-- tools/example-templates/extern-lib/ExternY.csproj | 3 +-- .../Project.csproj | 3 +-- .../standalone-console/Project.csproj | 3 +-- .../standalone-lib-without-using/Project.csproj | 3 +-- .../standalone-lib/Project.csproj | 3 +-- 15 files changed, 21 insertions(+), 35 deletions(-) diff --git a/tools/ExampleTester.Tests/FastCsprojCompilationParserTests.cs b/tools/ExampleTester.Tests/FastCsprojCompilationParserTests.cs index db4d1f94f..86154ca84 100644 --- a/tools/ExampleTester.Tests/FastCsprojCompilationParserTests.cs +++ b/tools/ExampleTester.Tests/FastCsprojCompilationParserTests.cs @@ -83,7 +83,7 @@ public static void Defaults() - net6.0 + net9.0 @@ -105,7 +105,7 @@ public static void ParsesTargetFramework() - net6.0 + net9.0 @@ -119,7 +119,7 @@ public static void ParsesOutputType([Values("Library", "Exe", "WinExe")] string - net6.0 + net9.0 {outputType} @@ -139,7 +139,7 @@ public static void ParsesNullable([Values("enable", "disable", "annotations", "w - net6.0 + net9.0 {nullable} @@ -160,7 +160,7 @@ public static void ParsesAssemblyName() - net6.0 + net9.0 Xyz @@ -175,7 +175,7 @@ public static void ParsesAllowUnsafeBlocks([Values("true", "false")] string allo - net6.0 + net9.0 {allowUnsafeBlocks} @@ -200,7 +200,7 @@ public static void ParsesImplicitUsings([Values("true", "enable", "false", "disa - net6.0 + net9.0 {implicitUsings} diff --git a/tools/example-templates/code-in-class-lib-without-using/Project.csproj b/tools/example-templates/code-in-class-lib-without-using/Project.csproj index 42c15ae05..da5fa546e 100644 --- a/tools/example-templates/code-in-class-lib-without-using/Project.csproj +++ b/tools/example-templates/code-in-class-lib-without-using/Project.csproj @@ -1,11 +1,10 @@ - net6.0 + net9.0 $example-name true annotations - 12 diff --git a/tools/example-templates/code-in-class-lib/Project.csproj b/tools/example-templates/code-in-class-lib/Project.csproj index 42c15ae05..da5fa546e 100644 --- a/tools/example-templates/code-in-class-lib/Project.csproj +++ b/tools/example-templates/code-in-class-lib/Project.csproj @@ -1,11 +1,10 @@ - net6.0 + net9.0 $example-name true annotations - 12 diff --git a/tools/example-templates/code-in-main-without-using/Project.csproj b/tools/example-templates/code-in-main-without-using/Project.csproj index 1d23795a8..1475f9029 100644 --- a/tools/example-templates/code-in-main-without-using/Project.csproj +++ b/tools/example-templates/code-in-main-without-using/Project.csproj @@ -2,11 +2,10 @@ Exe - net6.0 + net9.0 annotations $example-name true - 12 diff --git a/tools/example-templates/code-in-main/Project.csproj b/tools/example-templates/code-in-main/Project.csproj index 1d23795a8..1475f9029 100644 --- a/tools/example-templates/code-in-main/Project.csproj +++ b/tools/example-templates/code-in-main/Project.csproj @@ -2,11 +2,10 @@ Exe - net6.0 + net9.0 annotations $example-name true - 12 diff --git a/tools/example-templates/code-in-partial-class/Project.csproj b/tools/example-templates/code-in-partial-class/Project.csproj index 1284619a7..919f7ea83 100644 --- a/tools/example-templates/code-in-partial-class/Project.csproj +++ b/tools/example-templates/code-in-partial-class/Project.csproj @@ -2,11 +2,10 @@ Exe - net6.0 + net9.0 $example-name true annotations - 12 diff --git a/tools/example-templates/extern-lib/ExampleProject.csproj b/tools/example-templates/extern-lib/ExampleProject.csproj index 991e41eff..c51c7b674 100644 --- a/tools/example-templates/extern-lib/ExampleProject.csproj +++ b/tools/example-templates/extern-lib/ExampleProject.csproj @@ -1,11 +1,10 @@ - net6.0 + net9.0 false CS0169 annotations - 9 diff --git a/tools/example-templates/extern-lib/ExternN2.csproj b/tools/example-templates/extern-lib/ExternN2.csproj index c46e546b5..77430f27a 100644 --- a/tools/example-templates/extern-lib/ExternN2.csproj +++ b/tools/example-templates/extern-lib/ExternN2.csproj @@ -1,10 +1,9 @@ - net6.0 + net9.0 false annotations - 9 diff --git a/tools/example-templates/extern-lib/ExternR1.csproj b/tools/example-templates/extern-lib/ExternR1.csproj index 1702c3e3c..59805d570 100644 --- a/tools/example-templates/extern-lib/ExternR1.csproj +++ b/tools/example-templates/extern-lib/ExternR1.csproj @@ -1,10 +1,9 @@ - net6.0 + net9.0 false annotations - 9 diff --git a/tools/example-templates/extern-lib/ExternX.csproj b/tools/example-templates/extern-lib/ExternX.csproj index 2352c5fe0..aa11502c6 100644 --- a/tools/example-templates/extern-lib/ExternX.csproj +++ b/tools/example-templates/extern-lib/ExternX.csproj @@ -1,10 +1,9 @@ - net6.0 + net9.0 false annotations - 9 diff --git a/tools/example-templates/extern-lib/ExternY.csproj b/tools/example-templates/extern-lib/ExternY.csproj index 37fd27528..d001ab65e 100644 --- a/tools/example-templates/extern-lib/ExternY.csproj +++ b/tools/example-templates/extern-lib/ExternY.csproj @@ -1,10 +1,9 @@ - net6.0 + net9.0 false annotations - 9 diff --git a/tools/example-templates/standalone-console-without-using/Project.csproj b/tools/example-templates/standalone-console-without-using/Project.csproj index d10ba4915..5906ff460 100644 --- a/tools/example-templates/standalone-console-without-using/Project.csproj +++ b/tools/example-templates/standalone-console-without-using/Project.csproj @@ -2,10 +2,9 @@ Exe - net6.0 + net9.0 enable disable - 12 $example-name true annotations diff --git a/tools/example-templates/standalone-console/Project.csproj b/tools/example-templates/standalone-console/Project.csproj index 613e8c1b5..1a29ed82e 100644 --- a/tools/example-templates/standalone-console/Project.csproj +++ b/tools/example-templates/standalone-console/Project.csproj @@ -2,10 +2,9 @@ Exe - net6.0 + net9.0 enable disable - 12 $example-name true annotations diff --git a/tools/example-templates/standalone-lib-without-using/Project.csproj b/tools/example-templates/standalone-lib-without-using/Project.csproj index 5ac189498..41f08d501 100644 --- a/tools/example-templates/standalone-lib-without-using/Project.csproj +++ b/tools/example-templates/standalone-lib-without-using/Project.csproj @@ -1,10 +1,9 @@ - net6.0 + net9.0 enable $example-name - 12 true annotations diff --git a/tools/example-templates/standalone-lib/Project.csproj b/tools/example-templates/standalone-lib/Project.csproj index 42c15ae05..da5fa546e 100644 --- a/tools/example-templates/standalone-lib/Project.csproj +++ b/tools/example-templates/standalone-lib/Project.csproj @@ -1,11 +1,10 @@ - net6.0 + net9.0 $example-name true annotations - 12 From e80088e1eac75025d7dca40e489d184c8935085d Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Wed, 12 Aug 2026 15:29:22 -0400 Subject: [PATCH 2/4] First pass at .net 9 tests Run tests for .NET 9 --- .../ExampleTester.Tests/FastCsprojCompilationParserTests.cs | 4 ++-- tools/ExampleTester/ExampleTester.csproj | 3 +++ tools/ExampleTester/FastCsprojCompilationParser.cs | 6 +++++- .../MarkdownConverter.Tests/MarkdownConverter.Tests.csproj | 2 +- tools/MarkdownConverter/MarkdownConverter.csproj | 6 +++--- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/tools/ExampleTester.Tests/FastCsprojCompilationParserTests.cs b/tools/ExampleTester.Tests/FastCsprojCompilationParserTests.cs index 86154ca84..67a64f891 100644 --- a/tools/ExampleTester.Tests/FastCsprojCompilationParserTests.cs +++ b/tools/ExampleTester.Tests/FastCsprojCompilationParserTests.cs @@ -94,7 +94,7 @@ public static void Defaults() result.AssemblyName.ShouldBe(Path.GetFileNameWithoutExtension(CsprojFileName)); result.CompilationOptions.AllowUnsafe.ShouldBeFalse(); result.ParseOptions.LanguageVersion.ShouldBe(LanguageVersion.CSharp10); // Due to net6.0 - result.CompilationOptions.WarningLevel.ShouldBe(6); // Due to net6.0 + result.CompilationOptions.WarningLevel.ShouldBe(9); // Due to net9.0 result.GeneratedSources.ShouldBeEmpty(); } @@ -109,7 +109,7 @@ public static void ParsesTargetFramework() - """).TargetFramework.ShouldBe("net6.0"); + """).TargetFramework.ShouldBe("net9.0"); } [Test] diff --git a/tools/ExampleTester/ExampleTester.csproj b/tools/ExampleTester/ExampleTester.csproj index c7f2bd809..15668d811 100644 --- a/tools/ExampleTester/ExampleTester.csproj +++ b/tools/ExampleTester/ExampleTester.csproj @@ -10,6 +10,9 @@ + + + diff --git a/tools/ExampleTester/FastCsprojCompilationParser.cs b/tools/ExampleTester/FastCsprojCompilationParser.cs index 37b17bf4d..71f5432c7 100644 --- a/tools/ExampleTester/FastCsprojCompilationParser.cs +++ b/tools/ExampleTester/FastCsprojCompilationParser.cs @@ -42,6 +42,9 @@ private sealed record TargetFrameworkInfo( private static readonly FrozenDictionary SupportedTargetFrameworks = new KeyValuePair[] { new("net6.0", new(Basic.Reference.Assemblies.Net60.References.All, LanguageVersion.CSharp10, DefaultWarningLevel: 6)), + new("net7.0", new(Basic.Reference.Assemblies.Net70.References.All, LanguageVersion.CSharp11, DefaultWarningLevel: 7)), + new("net8.0", new(Basic.Reference.Assemblies.Net80.References.All, LanguageVersion.CSharp12, DefaultWarningLevel: 8)), + new("net9.0", new(Basic.Reference.Assemblies.Net90.References.All, LanguageVersion.CSharp13, DefaultWarningLevel: 9)), }.ToFrozenDictionary(StringComparer.OrdinalIgnoreCase); private static readonly CSharpParseOptions DefaultParseOptions = new(preprocessorSymbols: [ @@ -58,7 +61,8 @@ private sealed record TargetFrameworkInfo( new("NU1605", ReportDiagnostic.Error), new("CS1702", ReportDiagnostic.Suppress), new("CS1701", ReportDiagnostic.Suppress), - new("CS8002", ReportDiagnostic.Suppress)]); + new("CS8002", ReportDiagnostic.Suppress), + new("SYSLIB0011", ReportDiagnostic.Error)]); public static CsprojParseResult ParseCsproj(XDocument csprojDocument, string filePath) { diff --git a/tools/MarkdownConverter.Tests/MarkdownConverter.Tests.csproj b/tools/MarkdownConverter.Tests/MarkdownConverter.Tests.csproj index 1c611ee78..6091ac56d 100644 --- a/tools/MarkdownConverter.Tests/MarkdownConverter.Tests.csproj +++ b/tools/MarkdownConverter.Tests/MarkdownConverter.Tests.csproj @@ -15,7 +15,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tools/MarkdownConverter/MarkdownConverter.csproj b/tools/MarkdownConverter/MarkdownConverter.csproj index a1964151d..affc012bb 100644 --- a/tools/MarkdownConverter/MarkdownConverter.csproj +++ b/tools/MarkdownConverter/MarkdownConverter.csproj @@ -11,9 +11,9 @@ - - - + + + From f9d64af3d5e9cfd6270c2cdde827b57dbd89be65 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Wed, 12 Aug 2026 16:50:25 -0400 Subject: [PATCH 3/4] Fix all unit tests. --- tools/ExampleTester.Tests/FastCsprojCompilationParserTests.cs | 2 +- tools/ExampleTester/ExampleTester.csproj | 3 ++- tools/ExampleTester/FastCsprojCompilationParser.cs | 4 +++- tools/StandardAnchorTags/StandardAnchorTags.csproj | 2 +- tools/Utilities/Utilities.csproj | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/ExampleTester.Tests/FastCsprojCompilationParserTests.cs b/tools/ExampleTester.Tests/FastCsprojCompilationParserTests.cs index 67a64f891..8ad393e0e 100644 --- a/tools/ExampleTester.Tests/FastCsprojCompilationParserTests.cs +++ b/tools/ExampleTester.Tests/FastCsprojCompilationParserTests.cs @@ -93,7 +93,7 @@ public static void Defaults() result.CompilationOptions.NullableContextOptions.ShouldBe(NullableContextOptions.Disable); result.AssemblyName.ShouldBe(Path.GetFileNameWithoutExtension(CsprojFileName)); result.CompilationOptions.AllowUnsafe.ShouldBeFalse(); - result.ParseOptions.LanguageVersion.ShouldBe(LanguageVersion.CSharp10); // Due to net6.0 + result.ParseOptions.LanguageVersion.ShouldBe(LanguageVersion.CSharp13); // Due to net9.0 result.CompilationOptions.WarningLevel.ShouldBe(9); // Due to net9.0 result.GeneratedSources.ShouldBeEmpty(); } diff --git a/tools/ExampleTester/ExampleTester.csproj b/tools/ExampleTester/ExampleTester.csproj index 15668d811..4a766e98a 100644 --- a/tools/ExampleTester/ExampleTester.csproj +++ b/tools/ExampleTester/ExampleTester.csproj @@ -13,12 +13,13 @@ + - + diff --git a/tools/ExampleTester/FastCsprojCompilationParser.cs b/tools/ExampleTester/FastCsprojCompilationParser.cs index 71f5432c7..5a390c072 100644 --- a/tools/ExampleTester/FastCsprojCompilationParser.cs +++ b/tools/ExampleTester/FastCsprojCompilationParser.cs @@ -45,10 +45,12 @@ private sealed record TargetFrameworkInfo( new("net7.0", new(Basic.Reference.Assemblies.Net70.References.All, LanguageVersion.CSharp11, DefaultWarningLevel: 7)), new("net8.0", new(Basic.Reference.Assemblies.Net80.References.All, LanguageVersion.CSharp12, DefaultWarningLevel: 8)), new("net9.0", new(Basic.Reference.Assemblies.Net90.References.All, LanguageVersion.CSharp13, DefaultWarningLevel: 9)), + new("net10.0", new(Basic.Reference.Assemblies.Net100.References.All, LanguageVersion.CSharp14, DefaultWarningLevel: 10)), }.ToFrozenDictionary(StringComparer.OrdinalIgnoreCase); private static readonly CSharpParseOptions DefaultParseOptions = new(preprocessorSymbols: [ - "TRACE", "RELEASE", "NET", "NET6_0", "NETCOREAPP", "NET5_0_OR_GREATER", "NET6_0_OR_GREATER", + "TRACE", "RELEASE", "NET", "NET9_0", "NETCOREAPP", "NET5_0_OR_GREATER", "NET6_0_OR_GREATER", + "NET7_0_OR_GREATER","NET8_0_OR_GREATER","NET9_0_OR_GREATER", "NETCOREAPP1_0_OR_GREATER", "NETCOREAPP1_1_OR_GREATER", "NETCOREAPP2_0_OR_GREATER", "NETCOREAPP2_1_OR_GREATER", "NETCOREAPP2_2_OR_GREATER", "NETCOREAPP3_0_OR_GREATER", "NETCOREAPP3_1_OR_GREATER"]); diff --git a/tools/StandardAnchorTags/StandardAnchorTags.csproj b/tools/StandardAnchorTags/StandardAnchorTags.csproj index 8a155f9b8..ccbc4232d 100644 --- a/tools/StandardAnchorTags/StandardAnchorTags.csproj +++ b/tools/StandardAnchorTags/StandardAnchorTags.csproj @@ -8,7 +8,7 @@ - + diff --git a/tools/Utilities/Utilities.csproj b/tools/Utilities/Utilities.csproj index b39c71234..1f670cbbc 100644 --- a/tools/Utilities/Utilities.csproj +++ b/tools/Utilities/Utilities.csproj @@ -8,7 +8,7 @@ - + From 6caa31431da82c00f327919d438ad6d15ff90b57 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Wed, 12 Aug 2026 17:05:12 -0400 Subject: [PATCH 4/4] Add roadmap comments Because I'll forget what we needed by the next time I do this. --- tools/ExampleTester/FastCsprojCompilationParser.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/ExampleTester/FastCsprojCompilationParser.cs b/tools/ExampleTester/FastCsprojCompilationParser.cs index 5a390c072..1bcee2aaa 100644 --- a/tools/ExampleTester/FastCsprojCompilationParser.cs +++ b/tools/ExampleTester/FastCsprojCompilationParser.cs @@ -39,6 +39,9 @@ private sealed record TargetFrameworkInfo( LanguageVersion DefaultLanguageVersion, int DefaultWarningLevel); + + // When we add new rows here, we need to add the corresponding NuGet package to ExampleTester.csproj. These packages provide the information used + // for the reference assemblies. private static readonly FrozenDictionary SupportedTargetFrameworks = new KeyValuePair[] { new("net6.0", new(Basic.Reference.Assemblies.Net60.References.All, LanguageVersion.CSharp10, DefaultWarningLevel: 6)), @@ -48,6 +51,8 @@ private sealed record TargetFrameworkInfo( new("net10.0", new(Basic.Reference.Assemblies.Net100.References.All, LanguageVersion.CSharp14, DefaultWarningLevel: 10)), }.ToFrozenDictionary(StringComparer.OrdinalIgnoreCase); + // When we add new versions, this list changes. You'll need to change the current release from ".NET9_0", + // and add necessary "NET?_0_OR_GREATER" symbols. private static readonly CSharpParseOptions DefaultParseOptions = new(preprocessorSymbols: [ "TRACE", "RELEASE", "NET", "NET9_0", "NETCOREAPP", "NET5_0_OR_GREATER", "NET6_0_OR_GREATER", "NET7_0_OR_GREATER","NET8_0_OR_GREATER","NET9_0_OR_GREATER",