3

我在尝试从 Azure DevOps 构建任务生成 DocFX 文档时收到这些警告(它在本地运行良好):

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.

错误来自dotnet build命令(调用该命令时 DocFX 会生成文档)。

这是我使用的 csproj 文件:

<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>

我做错了什么还是 DocFX 问题?

如果需要,这是我的代码分支:https ://github.com/softframe/railsharp/tree/feature/docs

4

1 回答 1

0

感谢LeoLiu-MSFT为我指明了正确的方向。在我将 VM 映像设置为这样之后,它就起作用azure-pipelines.ymlvs2017-win2016

pool:
  vmImage: vs2017-win2016

DocFX 需要 Visual Studio(或至少 VS Build Tools)才能构建文档。因此,因为 VS 是在本地安装的,而不是在我在 Azure DevOps(即windows-latest)中使用的 VM 映像上,这就是它在本地工作但在 Azure DevOps 中不工作的原因。

于 2019-05-05T13:43:18.133 回答