3

There's something I'm missing in DocFX configuration - so it does not generate proper documentation.

I have a following folder structure:

+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

My 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
  }
}

running the command docfx build generate documentation without erros but when navigating to http://locahost:8080 open directory listing instead the index.html from _site folder. I mean I see an web page with just folders list: api/ apidoc/ articles/ images/ _site/ etc.. and even If I enter into the _site folder and click on index.html - it does open the docfx generated page but clicking on 'Api documentation' on the top shows text: TODO: Add .NET projects to the src folder and run docfx to generate REAL API Documentation!

  • What should I reconfigure in docfx.json so it would correctly read /src folder and not /Documentation/src folder ?
  • Is this a correct way to exclude vendor/ folder from inside src/ folder ?
Alex F
  • 3,180
  • 2
  • 28
  • 40

1 Answers1

5

My mistake. Everything is working as normal.

I was using the code download from Github and compiled locally. The issue was not in configuration file (this working as expected) but in template generation. For some reason the code from Github coming without even 'default' template. So even after I execute the first step: docfx.exe metadata -> metadata generated but it never converted to Table Of Context (TOC) because template engine was missing. So running docfx.exe build + serve show the empty site. There's a separate Github page for 'default' template

Alex F
  • 3,180
  • 2
  • 28
  • 40