Docfx: Quickstart - NuGet - docfx.console - API files not generated

Created on 30 Jun 2020  路  4Comments  路  Source: dotnet/docfx

Operating System: (Windows or Linux or MacOS)

Windows 10 VS2019
DocFX Version Used:
2.56
Template used: (default or statictoc or contain custom template)
default
Steps to Reproduce:

  1. install docfx.console nuget package
  2. Build the project
  3. No API files generated in the api folder, only the index and toc pages are there.

Expected Behavior:

Documentation for API to be generated.

This method worked before.

Actual Behavior:
No HTML files generated for API

[Failure] Msbuild failed when processing the file 'C:\Users\weiya\Downloads\CatFacts\CatFacts.Core\CatFacts.Core.csproj' with message: Could not load SDK Resolver. A manifest file exists, but the path to the SDK Resolver DLL file could not be found.

Manifest file path 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\SdkResolvers\Microsoft.Build.NuGetSdkResolver\Microsoft.Build.NuGetSdkResolver.xml'

Most helpful comment

Thank you. The solution for me was simply to uninstall VS Buid Tools 2017, because docfx was still trying to use MSBuild from VS 2017.

Thanks for the excellent investigation. Sad to see that MSBuildLocator is not fixed.

All 4 comments

I have the same issue:

I have downloaded the latest release of docfx (2.56.2) and I'm using Visual Studio Community 2019 version 16.7.4. When I try to run docfx docfx.json --serve I get a log entry that says:

Info:[MetadataCommand.ExtractMetadata]Using msbuild C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin as inner compiler.

As you can see, docfx is using the MSBuild from an old VS 2017 installation (which actually should be uninstalled but appears that some files remain...). This cause other error like "unable to find DLL of SDK resolver" that block the metadata generation.

This is clearly linked to #6135, but a manual script shouldn't be required. Any ideas on why these obsolete file paths are being chosen?

Choosen SDK resolver path:

 C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\NuGet\Microsoft.Build.NuGetSdkResolver.dll

Desired SDK resolver path:

C:\Program Files (x86)\dotnet\sdk\3.1.301\Microsoft.Build.NuGetSdkResolver.dll

After some digging, here's what I found:

TL;DR

Visual Studio installation required (read below).
MsBuildLocator can be silly, setting explicit environment variables may help.

More details

DocFx uses MsBuildLocator to find installed msbuild instances, which in turn use their respective NuGetSdkResolvers (the thing that is missing) so my conclusion was that the wrong msbuild instance was being found. Reasons:

Thank you. The solution for me was simply to uninstall VS Buid Tools 2017, because docfx was still trying to use MSBuild from VS 2017.

Thanks for the excellent investigation. Sad to see that MSBuildLocator is not fixed.

Was this page helpful?
0 / 5 - 0 ratings