DocFX(在Azure DevOps中):未找到导入的项目“\15.0\Microsoft.Common.props”。

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


你是否在未安装Visual Studio 2017的私有代理上执行了构建?如果是,请尝试安装它并再次测试。 - Leo Liu
我正在使用 pool: vmImage: windows-latest。那么你的意思是说在该虚拟机映像上没有安装VS? - Maxime Gélinas
1个回答

0
感谢LeoLiu-MSFT 指导了我正确的方向。像这样设置 VM image 在azure-pipelines.yml 中为 vs2017-win2016 后,代码终于可用了:它工作了
pool:
  vmImage: vs2017-win2016

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接