Search code examples
.net-coredocfx

DocFx Error after installing dotnet core 2.1.300


I've create a simple console application along with a simple docfx project. When I run the DocFX command to generate the documentation I get the following metadata warning and becuasue the warning leads to the documentation not being generated.

[18-06-05 05:52:41.715]Warning:MetadataCommand.ExtractMetadataWorkspace failed with: [Failure] Msbuild failed when processing the file 'E:\Files\tmp\docx\docfx_project\src\src.csproj' with message: C:\Program Files\dotnet\sdk\2.1.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets: (198, 5): Error loading lock file 'E:\Files\tmp\docx\docfx_project\src\obj\project.assets.json' : Object reference not set to an instance of an object.

later in the output you see

[18-06-05 05:52:42.467]Warning:[MetadataCommand.ExtractMetadata]No metadata is generated for src.

Anyone else run into this problem? How can I get metadata to generate?

To recreate the project is pretty simple:

  1. goto dotnet cli tools command line
  2. docfx init
  3. cd src
  4. dotnet new console
  5. cd ..
  6. docfx

I have installed and using the dotnet sdk 2.1.300


Solution

  • With .net 2.1 there is a breaking change in the use of tools, which are now installed and used globally like this:

    dotnet watch
    dotnet user-secrets
    dotnet sql-cache
    dotnet dev-certs
    

    The developers of docfx are currently working on a version which supports .net 2.1 (docfx v3): https://github.com/dotnet/docfx/pull/2829

    Here you can see the current status of implemenation: https://github.com/dotnet/docfx/projects/1

    So the answer to your question is: as of yet you can't use docfx with .net 2.1