无法为版本为 1.0.16 的任务 VSBuild 加载任务处理程序 PowerShell

Unable to load task handler PowerShell for task VSBuild with version 1.0.16

我正在尝试使用 TFS 2015 设置构建服务器。我已经设置了一个代理并配置了在签入集合时自动构建。

构建失败并显示消息:

Unable to load task handler PowerShell for task VSBuild with version 1.0.16.

在这个问题中,答案是需要 powershell 版本 3 或更高版本:

在这种情况下,根据服务器配置选项,服务器上安装了 powershell 版本 2 和 4。

PS ..> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      4.0
WSManStackVersion              3.0
SerializationVersion           1.1.0.1
CLRVersion                     4.0.30319.42000
BuildVersion                   6.3.9600.17400
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion      2.2

Visual studio服务器上也安装了2015 pro

在网站 http://tfsserver:8080/tfs/DefaultCollection/_admin/_AgentQueue 上检查构建代理的 Capabilities 中的 Powershell 版本,然后更新您的代理,如下图所示:

原因是缺少指向模块目录的 Powershell 环境路径。通过直接在 Powershell 中尝试命令(失败)确认了 Powershell 的故障。 Powershell ISE 已加载(报告加载模块时出错),最终将路径与已知的良好安装进行比较,并识别出丢失的路径。