diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index b82956c2d21..10141d23778 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -10,7 +10,7 @@ runs: - uses: actions/setup-dotnet@v4 with: dotnet-version: | - 6.x + 9.x 8.x - run: npm install diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f12a5b4a463..7fbcefc84a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,9 +33,9 @@ jobs: - run: dotnet test -c Release -f net8.0 --no-build --collect:"XPlat Code Coverage" --consoleLoggerParameters:"Summary;Verbosity=Minimal" id: test-net80 - - run: dotnet test -c Release -f net6.0 --no-build --collect:"XPlat Code Coverage" --consoleLoggerParameters:"Summary;Verbosity=Minimal" + - run: dotnet test -c Release -f net9.0 --no-build --collect:"XPlat Code Coverage" --consoleLoggerParameters:"Summary;Verbosity=Minimal" if: matrix.os == 'ubuntu-latest' - id: test-net60 + id: test-net90 - run: npm i -g @percy/cli if: matrix.os == 'ubuntu-latest' diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 727c9c9464c..6ba3f724aba 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -13,11 +13,6 @@ jobs: permissions: packages: write steps: - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 9.x - - uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/Directory.Build.props b/Directory.Build.props index 46f3e4a1dc1..5dd3cbb2875 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ true - net6.0;net8.0 + net8.0;net9.0 net8.0;net9.0 Preview enable diff --git a/Directory.Packages.props b/Directory.Packages.props index 78128c82024..652ca3bee69 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -28,21 +28,7 @@ - - - - - - - - - - - - - - - + diff --git a/docs/docs/dotnet-api-docs.md b/docs/docs/dotnet-api-docs.md index a1ff5da1474..a1d81f5be61 100644 --- a/docs/docs/dotnet-api-docs.md +++ b/docs/docs/dotnet-api-docs.md @@ -87,7 +87,7 @@ If your project targets multiple target frameworks, docfx internally builds each }], "dest": "api", "properties": { - "TargetFramework": "net6.0" + "TargetFramework": "net8.0" } }, } diff --git a/docs/index.md b/docs/index.md index bf0f6bc0c3b..ee497ffed05 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,7 +8,7 @@ In this section we will build a simple documentation site on your local machine. > Prerequisites > - Familiarity with the command line -> - Install [.NET SDK](https://dotnet.microsoft.com/en-us/download) 6.0 or higher +> - Install [.NET SDK](https://dotnet.microsoft.com/en-us/download) 8.0 or higher > - Install [Node.js](https://nodejs.org/) v20 or higher Make sure you have [.NET SDK](https://dotnet.microsoft.com/en-us/download) installed, then open a terminal and enter the following command to install the latest docfx: diff --git a/docs/tutorial/howto_build_your_own_type_of_documentation_with_custom_plug-in.md b/docs/tutorial/howto_build_your_own_type_of_documentation_with_custom_plug-in.md index 561f217c7e6..fb9ec81686d 100644 --- a/docs/tutorial/howto_build_your_own_type_of_documentation_with_custom_plug-in.md +++ b/docs/tutorial/howto_build_your_own_type_of_documentation_with_custom_plug-in.md @@ -15,7 +15,7 @@ Goal and limitation Preparation ----------- -1. Create a new C# class library targeting `net6.0` or later. +1. Create a new C# class library targeting `net8.0` or later. 2. Add NuGet package reference to `System.Composition`, `Docfx.Plugins` and `Docfx.Common`. diff --git a/samples/seed/dotnet/project/Project.Core/BuildFromProject.Core.csproj b/samples/seed/dotnet/project/Project.Core/BuildFromProject.Core.csproj index a90328379a1..639eaa34ad3 100644 --- a/samples/seed/dotnet/project/Project.Core/BuildFromProject.Core.csproj +++ b/samples/seed/dotnet/project/Project.Core/BuildFromProject.Core.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 latest enable enable diff --git a/samples/seed/dotnet/project/Project/BuildFromProject.csproj b/samples/seed/dotnet/project/Project/BuildFromProject.csproj index c3271976a56..bfef038c926 100644 --- a/samples/seed/dotnet/project/Project/BuildFromProject.csproj +++ b/samples/seed/dotnet/project/Project/BuildFromProject.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 latest enable enable diff --git a/samples/seed/dotnet/solution/CatLibrary.Core/CatLibrary.Core.csproj b/samples/seed/dotnet/solution/CatLibrary.Core/CatLibrary.Core.csproj index 6f2aed608ee..9d5a3ce7408 100644 --- a/samples/seed/dotnet/solution/CatLibrary.Core/CatLibrary.Core.csproj +++ b/samples/seed/dotnet/solution/CatLibrary.Core/CatLibrary.Core.csproj @@ -1,5 +1,5 @@  - net6.0 + net8.0 - \ No newline at end of file + diff --git a/samples/seed/dotnet/solution/CatLibrary/CatLibrary.csproj b/samples/seed/dotnet/solution/CatLibrary/CatLibrary.csproj index a24c9ef8923..f4377e8b0af 100644 --- a/samples/seed/dotnet/solution/CatLibrary/CatLibrary.csproj +++ b/samples/seed/dotnet/solution/CatLibrary/CatLibrary.csproj @@ -1,6 +1,6 @@  - net6.0 + net8.0 true diff --git a/src/Docfx.App/Docfx.App.csproj b/src/Docfx.App/Docfx.App.csproj index bafce2678e1..12db285be2e 100644 --- a/src/Docfx.App/Docfx.App.csproj +++ b/src/Docfx.App/Docfx.App.csproj @@ -1,7 +1,8 @@ - true - 2.70.0 + + false + 2.78.0 Docfx published as a library for extensibility and advanced customization diff --git a/src/Docfx.Build/Conceptual/WordCounter.cs b/src/Docfx.Build/Conceptual/WordCounter.cs index 4efb8208626..45b7377d8f6 100644 --- a/src/Docfx.Build/Conceptual/WordCounter.cs +++ b/src/Docfx.Build/Conceptual/WordCounter.cs @@ -8,13 +8,7 @@ namespace Docfx.Build.ConceptualDocuments; internal static class WordCounter { private static readonly string[] ExcludeNodeXPaths = ["//title"]; - -#if NET8_0_OR_GREATER private static readonly System.Buffers.SearchValues SpecialChars = System.Buffers.SearchValues.Create(".?!;:,()[]"); -#else - private static readonly string SpecialChars = ".?!;:,()[]"; -#endif - private static readonly char[] DelimiterChars = [' ', '\t', '\n']; public static long CountWord(string html) diff --git a/src/Docfx.Build/DocumentBuildContext.cs b/src/Docfx.Build/DocumentBuildContext.cs index 3bdff81d6e8..4d272514036 100644 --- a/src/Docfx.Build/DocumentBuildContext.cs +++ b/src/Docfx.Build/DocumentBuildContext.cs @@ -437,13 +437,9 @@ public IImmutableList GetTocFileKeySet(string key) public void RegisterToc(string tocFileKey, string fileKey) { -#if NET7_0_OR_GREATER ArgumentException.ThrowIfNullOrEmpty(fileKey); ArgumentException.ThrowIfNullOrEmpty(tocFileKey); -#else - if (string.IsNullOrEmpty(fileKey)) throw new ArgumentNullException(nameof(fileKey)); - if (string.IsNullOrEmpty(tocFileKey)) throw new ArgumentNullException(nameof(tocFileKey)); -#endif + TocMap.AddOrUpdate( fileKey, new HashSet(FilePathComparer.OSPlatformSensitiveRelativePathComparer) { tocFileKey }, diff --git a/src/Docfx.Build/TableOfContents/TocHelper.cs b/src/Docfx.Build/TableOfContents/TocHelper.cs index 5ff08517a92..caadd3b1829 100644 --- a/src/Docfx.Build/TableOfContents/TocHelper.cs +++ b/src/Docfx.Build/TableOfContents/TocHelper.cs @@ -46,14 +46,7 @@ internal static List ResolveToc(ImmutableList models) public static TocItemViewModel LoadSingleToc(string file) { -#if NET7_0_OR_GREATER ArgumentException.ThrowIfNullOrEmpty(file); -#else - if (string.IsNullOrEmpty(file)) - { - throw new ArgumentNullException(nameof(file)); - } -#endif if (!EnvironmentContext.FileAbstractLayer.Exists(file)) { diff --git a/src/Docfx.Build/TemplateProcessors/TemplateManager.cs b/src/Docfx.Build/TemplateProcessors/TemplateManager.cs index d4345e937f4..b6bf77015ba 100644 --- a/src/Docfx.Build/TemplateProcessors/TemplateManager.cs +++ b/src/Docfx.Build/TemplateProcessors/TemplateManager.cs @@ -87,12 +87,7 @@ public void ProcessTheme(string outputDirectory, bool overwrite) private bool TryExportResourceFiles(IEnumerable resourceNames, string outputDirectory, bool overwrite, string? regexFilter = null) { -#if NET7_0_OR_GREATER ArgumentException.ThrowIfNullOrEmpty(outputDirectory); -#else - if (string.IsNullOrEmpty(outputDirectory)) - throw new ArgumentNullException(nameof(outputDirectory)); -#endif if (!resourceNames.Any()) return false; diff --git a/src/Docfx.Build/TemplateProcessors/TemplateProcessor.cs b/src/Docfx.Build/TemplateProcessors/TemplateProcessor.cs index 3ec5c86c140..b4e9c8f30a5 100644 --- a/src/Docfx.Build/TemplateProcessors/TemplateProcessor.cs +++ b/src/Docfx.Build/TemplateProcessors/TemplateProcessor.cs @@ -44,21 +44,15 @@ public TemplateProcessor(ResourceFileReader resourceProvider, DocumentBuildConte public TemplateBundle GetTemplateBundle(string documentType) { -#if NET7_0_OR_GREATER ArgumentException.ThrowIfNullOrEmpty(documentType); -#else - if (string.IsNullOrEmpty(documentType)) throw new ArgumentNullException(nameof(documentType)); -#endif + return _templateCollection[documentType]; } public bool TryGetFileExtension(string documentType, out string fileExtension) { -#if NET7_0_OR_GREATER ArgumentException.ThrowIfNullOrEmpty(documentType); -#else - if (string.IsNullOrEmpty(documentType)) throw new ArgumentNullException(nameof(documentType)); -#endif + fileExtension = string.Empty; if (_templateCollection.Count == 0) return false; var templateBundle = _templateCollection[documentType]; diff --git a/src/Docfx.Common/Path/RelativePath.cs b/src/Docfx.Common/Path/RelativePath.cs index 8e783c36c42..be23480f3a3 100644 --- a/src/Docfx.Common/Path/RelativePath.cs +++ b/src/Docfx.Common/Path/RelativePath.cs @@ -187,14 +187,7 @@ public string GetFileNameWithoutExtension() public RelativePath ChangeFileName(string fileName) { -#if NET7_0_OR_GREATER ArgumentException.ThrowIfNullOrEmpty(fileName); -#else - if (string.IsNullOrEmpty(fileName)) - { - throw new ArgumentNullException(nameof(fileName)); - } -#endif if (fileName.Contains('\\') || fileName.Contains('/') || fileName == ".." || fileName == ".") { diff --git a/src/Docfx.Dotnet/Docfx.Dotnet.csproj b/src/Docfx.Dotnet/Docfx.Dotnet.csproj index b06a319ad05..9dbc6ec171a 100644 --- a/src/Docfx.Dotnet/Docfx.Dotnet.csproj +++ b/src/Docfx.Dotnet/Docfx.Dotnet.csproj @@ -28,11 +28,6 @@ - - - - - diff --git a/src/Docfx.Dotnet/DotnetApiCatalog.cs b/src/Docfx.Dotnet/DotnetApiCatalog.cs index 019d46e54e1..1a1ffe66aae 100644 --- a/src/Docfx.Dotnet/DotnetApiCatalog.cs +++ b/src/Docfx.Dotnet/DotnetApiCatalog.cs @@ -57,8 +57,6 @@ internal static async Task Exec(MetadataJsonConfig config, DotnetApiOptions opti { var stopwatch = Stopwatch.StartNew(); - EnsureMSBuildLocator(); - try { string originalGlobalNamespaceId = VisitorHelper.GlobalNamespaceId; @@ -116,26 +114,6 @@ void WriteYaml(string outputFolder, string id, Build.ApiPage.ApiPage apiPage) } } - private static void EnsureMSBuildLocator() - { -#if NET6_0 - try - { - if (!Microsoft.Build.Locator.MSBuildLocator.IsRegistered) - { - var vs = Microsoft.Build.Locator.MSBuildLocator.RegisterDefaults() ?? throw new Docfx.Exceptions.ExtractMetadataException( - $"Cannot find a supported .NET Core SDK. Install .NET Core SDK {Environment.Version.Major}.{Environment.Version.Minor}.x to build .NET API docs."); - - Logger.LogInfo($"Using {vs.Name} {vs.Version}"); - } - } - catch (Exception e) - { - throw new Docfx.Exceptions.ExtractMetadataException(e.Message, e); - } -#endif - } - private static ExtractMetadataConfig ConvertConfig(MetadataJsonItemConfig configModel, string configDirectory, string outputDirectory) { var projects = configModel.Src; diff --git a/src/Docfx.Dotnet/SymbolFormatter.Symbols.cs b/src/Docfx.Dotnet/SymbolFormatter.Symbols.cs index 35024286f7a..4ed64f8862b 100644 --- a/src/Docfx.Dotnet/SymbolFormatter.Symbols.cs +++ b/src/Docfx.Dotnet/SymbolFormatter.Symbols.cs @@ -214,12 +214,9 @@ private class PropertySymbol : IPropertySymbol public string ToDisplayString(SymbolDisplayFormat format = null) => Inner.ToDisplayString(format); public ImmutableArray ToMinimalDisplayParts(SemanticModel semanticModel, int position, SymbolDisplayFormat format = null) => Inner.ToMinimalDisplayParts(semanticModel, position, format); public string ToMinimalDisplayString(SemanticModel semanticModel, int position, SymbolDisplayFormat format = null) => Inner.ToMinimalDisplayString(semanticModel, position, format); - -#if NET8_0_OR_GREATER public IPropertySymbol PartialDefinitionPart => Inner.PartialDefinitionPart; public IPropertySymbol PartialImplementationPart => Inner.PartialImplementationPart; public bool IsPartialDefinition => Inner.IsPartialDefinition; -#endif } public class MethodSymbol : IMethodSymbol diff --git a/src/Docfx.MarkdigEngine/MarkdigMarkdownService.cs b/src/Docfx.MarkdigEngine/MarkdigMarkdownService.cs index dcfeb4e0c57..3a56eaa6296 100644 --- a/src/Docfx.MarkdigEngine/MarkdigMarkdownService.cs +++ b/src/Docfx.MarkdigEngine/MarkdigMarkdownService.cs @@ -45,13 +45,7 @@ public MarkupResult Markup(string content, string filePath) public MarkupResult Markup(string content, string filePath, bool multipleYamlHeader) { ArgumentNullException.ThrowIfNull(content); - -#if NET7_0_OR_GREATER ArgumentException.ThrowIfNullOrEmpty(filePath); -#else - if (string.IsNullOrEmpty(filePath)) - throw new ArgumentNullException(nameof(filePath)); -#endif var pipeline = CreateMarkdownPipeline(isInline: false, multipleYamlHeader); diff --git a/src/docfx/docfx.csproj b/src/docfx/docfx.csproj index 64677f8f063..0ea31d91aab 100644 --- a/src/docfx/docfx.csproj +++ b/src/docfx/docfx.csproj @@ -19,7 +19,7 @@ --> - + $(TargetFrameworks.Split(";")[0]) diff --git a/test/Docfx.Dotnet.Tests/GenerateMetadataFromCSUnitTest.cs b/test/Docfx.Dotnet.Tests/GenerateMetadataFromCSUnitTest.cs index f36db495322..862bdf0d125 100644 --- a/test/Docfx.Dotnet.Tests/GenerateMetadataFromCSUnitTest.cs +++ b/test/Docfx.Dotnet.Tests/GenerateMetadataFromCSUnitTest.cs @@ -2580,12 +2580,7 @@ public void Undefined(ConsoleKey key = ConsoleKey.None) { } var undefined = output.Items[0].Items[0].Items[1]; Assert.NotNull(undefined); - -#if NET8_0_OR_GREATER Assert.Equal("public void Undefined(ConsoleKey key = ConsoleKey.None)", undefined.Syntax.Content[SyntaxLanguage.CSharp]); -#else - Assert.Equal("public void Undefined(ConsoleKey key = default)", undefined.Syntax.Content[SyntaxLanguage.CSharp]); -#endif } [Fact] @@ -2653,12 +2648,8 @@ public void EnumUndefinedValue(ConsoleKey? key = (ConsoleKey)999) { } var enumUndefinedDefault = output.Items[0].Items[0].Items[3]; Assert.NotNull(enumUndefinedDefault); - -#if NET8_0_OR_GREATER Assert.Equal("public void EnumUndefinedDefault(ConsoleKey? key = ConsoleKey.None)", enumUndefinedDefault.Syntax.Content[SyntaxLanguage.CSharp]); -#else - Assert.Equal("public void EnumUndefinedDefault(ConsoleKey? key = null)", enumUndefinedDefault.Syntax.Content[SyntaxLanguage.CSharp]); -#endif + var enumUndefinedValue = output.Items[0].Items[0].Items[4]; Assert.NotNull(enumUndefinedValue); Assert.Equal("public void EnumUndefinedValue(ConsoleKey? key = (ConsoleKey)999)", enumUndefinedValue.Syntax.Content[SyntaxLanguage.CSharp]); diff --git a/test/docfx.Snapshot.Tests/SamplesTest.SeedMarkdown/CatLibrary.CatException-1.verified.md b/test/docfx.Snapshot.Tests/SamplesTest.SeedMarkdown/CatLibrary.CatException-1.verified.md index 4831a85a189..6c0a8a74e25 100644 --- a/test/docfx.Snapshot.Tests/SamplesTest.SeedMarkdown/CatLibrary.CatException-1.verified.md +++ b/test/docfx.Snapshot.Tests/SamplesTest.SeedMarkdown/CatLibrary.CatException-1.verified.md @@ -24,7 +24,6 @@ public class CatException : Exception, ISerializable #### Inherited Members [Exception.GetBaseException\(\)](https://learn.microsoft.com/dotnet/api/system.exception.getbaseexception), -[Exception.GetObjectData\(SerializationInfo, StreamingContext\)](https://learn.microsoft.com/dotnet/api/system.exception.getobjectdata), [Exception.GetType\(\)](https://learn.microsoft.com/dotnet/api/system.exception.gettype), [Exception.ToString\(\)](https://learn.microsoft.com/dotnet/api/system.exception.tostring), [Exception.Data](https://learn.microsoft.com/dotnet/api/system.exception.data), diff --git a/test/docfx.Tests/Assets/multi-frameworks-test.csproj.sample.1 b/test/docfx.Tests/Assets/multi-frameworks-test.csproj.sample.1 index f7aca45d3c0..a8c7f4b4265 100644 --- a/test/docfx.Tests/Assets/multi-frameworks-test.csproj.sample.1 +++ b/test/docfx.Tests/Assets/multi-frameworks-test.csproj.sample.1 @@ -1,10 +1,10 @@  - net6.0;netstandard2.0 + net8.0;netstandard2.0 true - \ No newline at end of file + diff --git a/test/docfx.Tests/Assets/ref.csproj.sample.1 b/test/docfx.Tests/Assets/ref.csproj.sample.1 index 1b5656b92f9..de34d27f8d4 100644 --- a/test/docfx.Tests/Assets/ref.csproj.sample.1 +++ b/test/docfx.Tests/Assets/ref.csproj.sample.1 @@ -1,5 +1,5 @@  - net6.0 + net8.0 - \ No newline at end of file + diff --git a/test/docfx.Tests/Assets/template/plugins/plugins.csproj b/test/docfx.Tests/Assets/template/plugins/plugins.csproj index 1714e2a73bb..a95ef2ec35b 100644 --- a/test/docfx.Tests/Assets/template/plugins/plugins.csproj +++ b/test/docfx.Tests/Assets/template/plugins/plugins.csproj @@ -1,7 +1,7 @@ - + - net6.0 + net8.0 enable enable false diff --git a/test/docfx.Tests/Assets/test.csproj.sample.1 b/test/docfx.Tests/Assets/test.csproj.sample.1 index fb237e64e04..03511f974ed 100644 --- a/test/docfx.Tests/Assets/test.csproj.sample.1 +++ b/test/docfx.Tests/Assets/test.csproj.sample.1 @@ -1,6 +1,6 @@  - net6.0 + net8.0 true @@ -8,4 +8,4 @@ ClassLibrary1 - \ No newline at end of file + diff --git a/test/docfx.Tests/Assets/test.vbproj.sample.1 b/test/docfx.Tests/Assets/test.vbproj.sample.1 index 05d1cf1730f..57aa05d91c7 100644 --- a/test/docfx.Tests/Assets/test.vbproj.sample.1 +++ b/test/docfx.Tests/Assets/test.vbproj.sample.1 @@ -1,6 +1,6 @@  - net6.0 + net8.0 testVBproj1 test.sample.1 On diff --git a/test/docfx.Tests/MetadataCommandTest.cs b/test/docfx.Tests/MetadataCommandTest.cs index f83da132da0..e01761fb414 100644 --- a/test/docfx.Tests/MetadataCommandTest.cs +++ b/test/docfx.Tests/MetadataCommandTest.cs @@ -69,7 +69,7 @@ await DotnetApiCatalog.Exec( { Dest = _outputFolder, Src = new(new FileMappingItem(projectFile)) { Expanded = true }, - Properties = new() { ["TargetFramework"] = "net6.0" }, + Properties = new() { ["TargetFramework"] = "net8.0" }, }), new(), Directory.GetCurrentDirectory());