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:
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'
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:
Visual Studio installation required (read below).
MsBuildLocator can be silly, setting explicit environment variables may help.
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:
Error opening project <path to project>.csproj: Unable to load one or more of the requested types. appear (the error I was getting).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.
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.