2017-04-24 173 views
1

我在DocFX配置中缺少某些东西 - 因此它不会生成正确的文档。DocFX'src'文件夹的相对路径

我有一个下面的文件夹结构:

+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开放目录列表,而不是从index.html_site文件夹。我的意思是我看到的网页,只有文件夹列表: API/ apidoc/ 文章/ 图像/ _site/ 等。 即使我进入_site文件夹,点击index.html - 它确实开启docfx生成的页面,但点击“API文档”在顶部显示的文字:TODO: Add .NET projects to the src folder and run docfx to generate REAL API Documentation!

  • 我应该在docfx.json重新配置,因此可以正确读取/ src文件夹,而不是/文档/ src文件夹?
  • 这是从src/文件夹中排除vendor/文件夹的正确方法吗?

回答

0

我的错误。一切正常。

我正在使用从Github下载的代码并在本地编译。问题不在配置文件中(按预期工作),而是在模板生成中。由于某种原因,来自Github的代码甚至没有“默认”模板。所以即使在我执行第一步之后:docfx.exe metadata - >生成了元数据,但从未转换为Table Of Context(TOC),因为缺少模板引擎。所以运行docfx.exe build + serve显示空的网站。有一个单独的Github“默认”模板页面