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
He seems to have the same probem: http://www.michalkomorowski.com/2017/04/why-i-hate-roslyn-even-more.html
Workaround: https://github.com/dotnet/docfx/issues/1969#issuecomment-323235324
Hi @bitbonk does the error only happen to empty project or to every project?
@vicancy every project
@Sunzhuokai Thanks, only Visual Studio 2017 15.3 installed or other versions are also installed?
14.0 is available if Visual Studio 2015 installed锛宨f only Visual Studio 2017 15.3 installed,the avaliable values are "2.0", "3.5", "4.0". may be it is related to this https://docs.microsoft.com/en-us/visualstudio/msbuild/what-s-new-in-msbuild-15-0
https://github.com/Microsoft/msbuild/issues/2427
Hi @Sunzhuokai Could you try 2.22.3 to see if it solves the issue, I updated Compiler to 2.3.1
@vicancy only works in visual studio , not work in command-line tool
Hi @Sunzhuokai what does works in vs mean?
@vicancy docfx.console
unfortunately 2.22.3 does not fix the problem
This problem is totally weird:
@vicancy
I think I should revert #1735, It is not a good idea to contain a compiler inside docfx... otherwise every time VS updates, docfx has to update the compiler accordingly.
Can you explain a bit more?
Generally it would be desireable to have a compiler embedded in docfx. But AFAIK that would be only useful if it it is fully selfcontained and does not induce additional external depdencies/prerequisits.
It seems that even though you have a compiler inside docfx, it is still required to have Visual Studio installed (in the right version).
Looking at #1735, all you did is upgrade Microsoft.CodeAnalysis.* to 2.2. Why did this change "remove the build tool dependency"?
Just some wild guesses here:
The nuget pakage Microsoft.Net.Compilers.2.3.1 comes with Microsoft.CodeAnalysis* in version 2.3.1-beta1-6191-13
But afer the upgrade to docfx 2.22.3 c:\ProgramData\chocolatey\lib\docfx\tools\ contains Microsoft.CodeAnalysis* in version 2.2.0-beta1-61624-04
If I compare the contents of 2.22.2 with 2.22.3 it looks like the Microsoft.Net.Compilers stuff did not change.
Is that the way it supposed to be?
No @bitbonk I did an uncomplete fix 馃槩 BTW your issue solved? looks like @Sunzhuokai still has the issue
@bitbonk Actually the change is adding Microsoft.Net.Compillers package, it is the C# and VB compiler. Yes you are right, our intention is to make docfx selfcontained, but looks like we still dependents on msbuild to resolve projects.
I still do have the issue (I changed the text of my comment). I accidentally had changed the toolvesion to 14 in my project.
@bitbonk The issue is related to Microsoft/msbuild#2427 DocFX uses MSBuildWorkspace to open projects, which still tries to read the registry for toolversions, however with 15.3 registry entry is removed. I am still looking into the issue and I reproed it locally when I update to 15.3 馃槩 I update Microsoft.Build packages to 15.3 however does not solve the issue..
@vicancy https://github.com/Microsoft/msbuild/issues/2427#issuecomment-323051221
To be clear, you should NOT need to ship MSBuild yourself.
To me that sounds like it might be better to revert #1735 ??
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
@vicancy thanks,great!
@vicancy Thanks, Option 1 works for me :)
So it seems I have the opposite problem. DocFx 2.23.1.0 gives me the following error when using VS2015 and works with VS2017.
[17-08-30 01:16:39.462]Warning:[MetadataCommand.ExtractMetadata]Workspace failed with: [Failure] Msbuild failed when processing the file 'C:\CMICWORK\FileWorks\DocFx\FileWorks\FileWorks.csproj' with message: The tools version "15.0" is unrecognized. Available tools versions are "14.0", "2.0", "3.5", "4.0". C:\CMICWORK \FileWorks\DocFx\FileWorks\FileWorks.csproj
Thanks
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.
I'm trying to use docfx v2.28.1.0 against Visual Studio Enterprise 15.5 and hitting the following error. Is this related?
Build succeeded with warning.
[17-12-08 12:03:54.681]Warning:[MetadataCommand.ExtractMetadata]Workspace failed with: [Failure] Msbuild failed when processing the file 'C:\development\github\ImageSharp\src\ImageSharp\ImageSharp.csproj' with message: Invalid static method invocation syntax: "[MSBuild]::IsRunningFromVisualStudio()". Method '[MSBuild]::IsRunningFromVisualStudio' 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\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CrossTargeting.targets
[17-12-08 12:03:54.682]Warning:[MetadataCommand.ExtractMetadata]Project 'C:\development\github\ImageSharp\src\ImageSharp\ImageSharp.csproj' does not contain any documents.
[17-12-08 12:03:54.683]Warning:[MetadataCommand.ExtractMetadata]No metadata is generated for ImageSharp.
[17-12-08 12:03:54.684]Warning:[BuildCommand.BuildCore.Build Document.CompilePhaseHandlerWithIncremental.TocDocumentProcessor.Prebuild.BuildTocDocument](api/toc.yml)TOC item (Href:index.md ) with empty name found. Missing a name?
4 Warning(s)
0 Error(s)
C:\development\github\ImageSharp>docfx -v
docfx 2.28.1.0
@JimBobSquarePants that is related to https://github.com/dotnet/docfx/issues/2265, please update to 2.28.2
Thanks @vicancy FYI Chocolatey was installing 2.28.1 3 hours ago.
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
Most helpful comment
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:VSINSTALLDIRto where your VS locates