Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DocFX currently only supports generating metadata with namespace defined #417

Closed
simax opened this issue Jun 22, 2016 · 9 comments · Fixed by #457
Closed

DocFX currently only supports generating metadata with namespace defined #417

simax opened this issue Jun 22, 2016 · 9 comments · Fixed by #457
Assignees
Milestone

Comments

@simax
Copy link

simax commented Jun 22, 2016

When I run docfx docfx.json --serve from the command line I get warnings for a couple of projects in my solution.

Warning: No namespace is found in assembly XXX. DocFX currently only supports generating metadata with namespace defined.

How do I fix this?

@chenkennt
Copy link
Contributor

@simax it's not a good practice to define types in global namespace. Do you have any classes defined in global namespace?

@simax
Copy link
Author

simax commented Jun 23, 2016

No, all classes etc are defined inside namespaces. Its only producing this error for 2 of the 8 projects in the solution. I can't see anything different about those 2.

@AcousticGuitar
Copy link

AcousticGuitar commented Jun 27, 2016

I have the same issue. I downloaded DocFx added it to my environment's path. I then per instructions performed the docfx init and docfx --serve. Everything came up but needed additional content. The code I'm trying to include lives in 7 different projects, so I added one of them to the docfx\src folder per instructions. I went back to the command line and ran docfx init (again) and docfx -serve (again). Attempting to serve the file resulted in:

No namespace is found in assembly X.Y.Z DocFX currently only support generating metadata with namespace defined.   
No files are found with glob patter apidoc/**.md, excluding obj/**, _site/**, under directory (the docfx directory).

Note I've code commented all the content in that project, and if I use Sandcastle Help File Builder all of the documentation shows up with no issues. The project X.Y.Z has no issues compiling and runnning, it's just when I attempt to document it in docFX where these namespace issues happen.

Please advise.

@AcousticGuitar
Copy link

AcousticGuitar commented Jun 27, 2016

After a bit of hacking was able to get this to work. Here's the solution for me.

Using DocFX to document "other" projects

  1. Follow instructions on getting DocFx onto your system and entering the proper Environment Path
  2. Create a new document folder for this project.
  3. Open the command prompt to that new folder and type in docfx init.
  4. Press the enter key to take the default answers to each question
  5. Copy the project or solution files to be documented with all of the source code into the "src" folder
  6. In the same command window type in docfx docfx.json --serve
  7. Open browser to http://localhost:8080/
  8. Click on the tab "Api Documentation" to see the code comments.

@simax
Copy link
Author

simax commented Jun 28, 2016

Interesting, my solution is an existing .Net solution and I placed the docfx_project folder at the same level as my existing src folder.

I then configured my docfx.json as follows:

{
  "metadata": [
    {
      "src": [
        {
          "cwd":  "../",
          "files": [
            "src/**.csproj"
          ],
          "exclude": [
            "**/obj/**",
            "**/bin/**",
            "_site/**"
          ]
        }
      ],
      "dest": "api",
      "filter": "filterconfig.yml"
    }
  ],
  "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",
    "template": [
      "default"
    ],
    "noLangKeyword": false
  }
}

Although this appears to be a valid configuration as per the docs. It produces the error I described. I don't understand why it only complains about 2 of the 8 projects in the solution.

@chenkennt
Copy link
Contributor

Actually the message is not accurate, it actually means there're types under global namespace. I suspect they're compiler generated types. We'll update the code to print out all types under global namespace so that you can get more details about this issue.

@superyyrrzz
Copy link
Contributor

@simax We improved the warning message in dev branch. You can try it to see whether it still generates warning.

@simax
Copy link
Author

simax commented Jul 5, 2016

Unfortunately I only have VS2013 installed at the moment. so I can't build the dev branch to try it.

@chenkennt
Copy link
Contributor

then you can wait until our next release which will be available in two weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants