使用本地 TFS 持续部署 DocFx 文档

Continuous deployment of DocFx documentation using on-premises TFS

我正在努力使用本地 TFS 为 DocFX 项目设置持续部署过程。

描述了该过程here, however the example walk-through is for VSTS, and I have on-premises TFS (version 2013). The basic idea is to build and deploy the documentation website on every checkin. The DocFx Build Tasks该过程使用的扩展似乎确实支持本地 TFS ...我只是看不出如何让它工作!

我有一个包含单个 C# 项目的 VS 解决方案,该项目具有对 docfx.console 版本 2.38.1(最新)的 Nuget 引用。当我在本地 PC 上构建 VS 时,_sites 文件夹中正确填充了 HTML。但是,在构建服务器上构建时,构建失败 'warning MSB4078: The project file "DocFx.csproj" is not supported by MSBuild and cannot be built.'

然后我发现了 DocFx Build Tasks 扩展,它看起来可能会解决我的问题。

我已经下载了 .VSIX,但不知道在哪里以及如何安装它。

如果我 运行 它直接在构建服务器(或我的本地 PC)上,则会出现错误 "This extension is not installable on any currently installed products."。这是来自安装日志:

31/08/2018 14:31:54 - Supported Products : 
31/08/2018 14:31:54 - Microsoft.VisualStudio.Services
31/08/2018 14:31:54 - Version : 
31/08/2018 14:31:54 - 
31/08/2018 14:31:54 - References : 
31/08/2018 14:31:54 - Signature Details...
31/08/2018 14:31:54 - Extension is not signed.
31/08/2018 14:31:54 - 
31/08/2018 14:31:54 - Searching for applicable products...
31/08/2018 14:31:54 - Found installed product - Microsoft Visual Studio 2012 Shell (Integrated)
31/08/2018 14:31:54 - Found installed product - Global Location
31/08/2018 14:31:54 - Found installed product - ssms
31/08/2018 14:31:54 - Found installed product - Visual Studio Community 2017
31/08/2018 14:31:54 - Found installed product - Visual Studio Build Tools 2017 (2)
31/08/2018 14:31:54 - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.

我在 TFS 2013 门户中似乎也看不到上传扩展的选项(尽管更高版本似乎有这个)。

我需要做什么?

根据错误消息“'warning MSB4078: The project file "DocFx.csproj" is not supported by MSBuild and cannot be built.'”,您似乎使用了不正确的 MSBuild 版本来构建项目。参考类似线程:

对于 TFS 2013 + VS 2017 组合,您可能需要将 ToolPath 更改为完整的 MSBuild 路径:"C:\Program Files (x86)\Microsoft Visual Studio17\Professional\MSBuild.0\Bin"。引用此线程:

此外,您还可以尝试在构建定义中指定 MSBuild arguments。如:/tv:15.0 /p:VisualStudioVersion=15.0用VS2017构建。

DocFx Build Tasks extension is not supported in TFS 2013. To use the extension you need migrating to vNext build (TFS 2015 and later version). To install extension please see Install extensions for Team Foundation Server (TFS)

建议您迁移到现代版本的 TFS(vNext 构建系统)。参见 Why You Should Switch to Build VNext