docfx: docfx metadata fails after installing Visual Studio 2017 Update 15.3

I just installed Visual Studio 2017 15.3 and now I cannot run docfx metadata anymore because I get the following error:

[17-08-16 12:22:20.437]Warning:[ExtractMetadata]Workspace failed with: [Failure] Msbuild failed when processing the file ‘C:\foo\bar\bar.csproj’ with message: The tools version “15.0” is unrecognized. Available tools versions are “14.0”, “2.0”, “3.5”, “4.0”. C:\foo\bar\bar.csproj

The interseting part here is that my csproj file does not even speficy version 15:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>

If I change it to ToolsVersion="14.0 it works, but I can’t change the tools version for now. And if I were to change it, I would like to change it to 15, wich does not work due to the above error.

DocFX Version Used: 2.22.2.0

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 27 (17 by maintainers)

Most upvoted comments

Gladly we have an easy workaround here before https://github.com/Microsoft/msbuild/issues/2369 is resolved. @bitbonk @Sunzhuokai Option 1. Invoke the command from Developer Command Prompt for VS2017 Option 2. Set the following env before calling docfx metadata:

SET VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise
SET VisualStudioVersion=15.0

VSINSTALLDIR to where your VS locates

I am using docfx on a machine with VS2017 15.8 Preview 5 installed. Again this issue happened, and the workaround is to use a stable VS release and set the two environment variables.

Instead of installing the full VS, I only installed Visual Studio Build Tools 2017, and the settings are,

SET VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools
SET VisualStudioVersion=15.0

Here is a quickfix for TFS OnPrem related to comment 323235324

SET VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise SET VisualStudioVersion=15.0

On TFS OnPrem you can set variables in the build definition, corresponding to the above environment variables.

@JimBobSquarePants that is related to https://github.com/dotnet/docfx/issues/2265, please update to 2.28.2