DocFX中'src'文件夹的相对路径是什么?

3

在 DocFX 的配置中,我缺少了一些东西 - 这导致它无法生成适当的文档。

我有以下文件夹结构:

+Documentation
 |- _site
 |- api
 |- apidoc
 |- articles
 |- images
 |- src    <-- This folder is autogenerated by `docfx init` command as a folders above
  docfx.json
  index.md
  toc.md
+packages
 |- Microsoft.NETCore.Platforms.1.0.1
 |- ... other nuget folders
+src
 |- MyRealProject
   |- assets
   |- bin
   |- Commands
   |- obj
   |- Properties
   |- vendor      <- This folder should be excluded for documentation
   app.config
   MyRealProject.csproj
   MyRealProject.csproj.user
   Program.cs
+test
 |-MyRealProjext.XUnit
   |- bin
   |- obj
   |- Properties
   app.config
.gitattributes
.gitignore
.gitmodule
MyRealProject.sln

我的docfx.json文件:

{
  "metadata": [
    {
      "src": [
        {
          "files": [
            "**/*.csproj"
          ],
          "exclude": [
            "**/obj/**",
            "**/bin/**",
            "_site/**",
            "vendor/**"
          ],
          "src": "../src"
        }
      ],
      "dest": "api"
    }
  ],
  "build": {
    "content": [
      {
        "files": [
          "api/**.yml",
          "api/index.md"
        ]
      },
      {
        "files": [
          "articles/**.md",
          "articles/**/toc.yml",
          "toc.yml",
          "*.md"
        ],
        "exclude": [
          "obj/**",
          "_site/**"
        ]
      }
    ],
    "resource": [
      {
        "files": [
          "images/**"
        ],
        "exclude": [
          "obj/**",
          "_site/**"
        ]
      }
    ],
    "overwrite": [
      {
        "files": [
          "apidoc/**.md"
        ],
        "exclude": [
          "obj/**",
          "_site/**"
        ]
      }
     ],
     "dest": "_site",
     "globalMetadataFiles": [],
     "fileMetadataFiles": [],
    "template": [
      "default"
     ],
    "postProcessors": [],
    "noLangKeyword": false
  }
}

运行命令docfx build生成文档时没有错误,但是在导航到http://locahost:8080时,打开的是目录列表而不是_site文件夹中的index.html。我的意思是我看到一个只有文件夹列表的网页:     api /     apidoc /     articles /     images /     _site /     等等。 即使我进入_site文件夹并单击index.html,它也会打开docfx生成的页面,但在页面顶部单击“Api documentation”时,显示的文本为:TODO:将.NET项目添加到src文件夹中并运行docfx以生成REAL API文档!

  • 我应该如何重新配置docfx.json,以便正确读取/src文件夹而不是/Documentation/src文件夹?
  • 这是从src/文件夹中排除vendor/文件夹的正确方法吗?
1个回答

5

我犯了一个错误。一切都正常工作。

我使用从Github下载并在本地编译的代码。问题不在配置文件中(这个按预期工作),而是在模板生成中。出于某种原因,来自Github的代码甚至没有“default”模板。因此,即使执行了第一步:docfx.exe metadata -> 元数据已生成,但它从未转换为目录(TOC), 因为模板引擎缺失。因此,运行docfx.exe build+ serve 会显示空站点。有一个单独的GitHub页面用于“default”模板。


这有什么用处?除了逐个文件下载,没有其他独立下载的方式。 - David A. Gray

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接