I get these warning when trying to generate DocFX documentations from an Azure DevOps build task (it works fine locally):

Build succeeded with warning.
  [19-04-25 03:02:23.747]Warning:[MetadataCommand.ExtractMetadata](d:/a/1/s/src/RailSharp/RailSharp.csproj)Workspace failed with: [Failure] Msbuild failed when processing the file 'd:\a\1\s\src\RailSharp\RailSharp.csproj' with message: The imported project "\15.0\Microsoft.Common.props" was not found. Also, tried to find "\15.0\Microsoft.Common.props" in the fallback search path(s) for $(MSBuildExtensionsPath) - "C:\Program Files (x86)\MSBuild" . These search paths are defined in "C:\Users\VssAdministrator\.nuget\packages\docfx.console\2.42.0\tools\docfx.exe.Config". Confirm that the path in the <Import> declaration is correct, and that the file exists on disk in one of the search paths.  C:\Program Files\dotnet\sdk\2.2.105\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.props
  [19-04-25 03:02:23.747]Warning:[MetadataCommand.ExtractMetadata]Project 'd:\a\1\s\src\RailSharp\RailSharp.csproj' does not contain any documents.
  [19-04-25 03:02:23.747]Warning:[MetadataCommand.ExtractMetadata]No metadata is generated for RailSharp.

The error comes from the dotnet build command (DocFX generates the documentation when that command is invoked).

Here is the csproj file I use:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="docfx.console" Version="2.42.0">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>

</Project>

Im I doing something wrong or is it a DocFX issue?

Here is my code branch if needed: https://github.com/softframe/railsharp/tree/feature/docs

1 Answers

0
Maxime Gélinas On Best Solutions

Thanks to LeoLiu-MSFT for pointing me in the right direction. It worked after I setted the VM image in azure-pipelines.yml to vs2017-win2016 like this:

pool:
  vmImage: vs2017-win2016

DocFX require Visual Studio (or at least VS Build Tools) in order to build the documentation. So because VS was installed locally and not on the VM image I was using in Azure DevOps (i.e. windows-latest) thats why it worked locally but not in Azure DevOps.