DocFX Version Used:
2.38.1
Template used: (default or statictoc or contain custom template)
Custom template
Steps to Reproduce:
It also applies to VS2017 Build Tools if you upgrade to 15.8.
Expected Behavior:
docfx should work as usual.
Actual Behavior:
docfx simply failed with
[18-08-19 05:13:57.918]Warning:MetadataCommand.ExtractMetadataWorkspace failed with: [Failure] Msbuild failed when processing the file 'F:azurenew\docfx\sharpsnmplib\SharpSnmpLib\SharpSnmpLib.csproj' with message: Invalid static method invocation syntax: "[Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries($(TargetFrameworkIdentifier), $(TargetFrameworkVersion), $(TargetFrameworkProfile), $(PlatformTarget), $(TargetFrameworkRootPath), $(TargetFrameworkFallbackSearchPaths))". Method 'Microsoft.Build.Utilities.ToolLocationHelper.GetPathToStandardLibraries' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(
a,b)). C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets
Clearly docfx still depends on MSBuild 15.7 (check the code base), and does not work with MSBuild 15.8 due to some implementation changes.
A workaround is to download and install VS2017 Build Tools 15.7 from https://docs.microsoft.com/en-us/visualstudio/productinfo/installing-an-earlier-release-of-vs2017
Then before calling docfx, set environment variables,
if exist "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe" SET VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools
SET VisualStudioVersion=15.0
This gives you a chance to use latest VS2017, while still can compile at command line to generate documentation.
I only use the command line docfx (via Chocolatey), so this workaround works fine for me. If you use docfx in other ways, there can be other workarounds or none at all. So before upgrading VS, think twice.
It would be appreciated if docfx and MSBuild teams can better collaborate and sync up with each other in the future for new releases, before breaking end users who would like to keep using latest VS updates.
I got the same error. Thanks, @lextm for the workaround!
Any chance we could have an update from the docfx team about this issue (and #3225, my equivalent with a different workaround)? It's been nearly two weeks with no response. The longer this goes on, the more people there will be facing the issue as they update to VS 15.8.
@lextm @jskeet Thanks for reporting the issue. We are also aware of it and are working on the fix.
Thanks alll, it is working in docfx v2.39.1
Thanks. Close it now.
Most helpful comment
Any chance we could have an update from the docfx team about this issue (and #3225, my equivalent with a different workaround)? It's been nearly two weeks with no response. The longer this goes on, the more people there will be facing the issue as they update to VS 15.8.