即使安装了 Team Foundation Power Tool,Jenkins 也无法识别它

Team foundation power tool is not getting recognize by Jenkins even it's installed to it

我已经为 Jenkins 服务器安装了 Team foundation power tool。我安装了带有 Full VS 2015 的 TFS 2015。我想要 运行 从 TFS 中提取项目的 powershell 脚本。我可以从 Jenkins 服务器 运行 它。当我尝试使用 powershell 插件从 Jenkins 构建定义传递该脚本时。我收到有关 Team foundation power tool 的错误。 Jenkins 抱怨未安装 team Foundation power tool。我试图卸载并重新安装工具。我的 Jenkins 服务在 运行ning 下,我使用它安装了这个工具。此外,此工具不是特定于用户的。它是为所有用户安装的。有人可以帮忙吗?

Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.TeamFoundation.PowerShell' is not installed on this computer. At C:\Users\AppData\Local\Temp\jenkins4325377511943060199.ps1:22 char:1 + Add-PSSnapin Microsoft.TeamFoundation.PowerShell + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (Microsoft.TeamFoundation.PowerShell:String) [Add-PSSnapin], PSArgument Exception + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand Get-TfsChildItem : The term 'Get-TfsChildItem' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\Users\AppData\Local\Temp\jenkins4325377511943060199.ps1:25 char:10 + $items = Get-TfsChildItem $AutoDeployDir -Recurse -Server $tfsCollection + ~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Get-TfsChildItem:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

如您所见,我可以在服务器内手动 运行 它。

根据错误

Add-PSSnapin : The Windows PowerShell snap-in 'Microsoft.TeamFoundation.PowerShell' is not installed on this computer.

可能是 TFS Powertools 没有完全安装。默认情况下它不会安装 PS CmdLets.

因此,只需在重新安装期间添加它,然后再次尝试使用 Jenkins 构建。

更多方法请参考这个类似问题:

我明白了。这是 x32 和 x64 之间的工具问题。您将需要添加注册表来解决此问题。将以下内容复制到 *.reg 文件中,然后双击文件将其安装到注册表中。

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\PowerShellSnapIns\Microsoft.TeamFoundation.PowerShell] "PowerShellVersion"="4.0" "Vendor"="Microsoft Corporation" "Description"="This is a PowerShell snap-in that includes the Team Foundation Server cmdlets." "VendorIndirect"="Microsoft.TeamFoundation.PowerShell,Microsoft" "DescriptionIndirect"="Microsoft.TeamFoundation.PowerShell,This is a PowerShell snap-in that includes the Team Foundation Server cmdlets." "Version"="14.0.0.0" "ApplicationBase"="C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools" "AssemblyName"="Microsoft.TeamFoundation.PowerTools.PowerShell, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" "ModuleName"="C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools\Microsoft.TeamFoundation.PowerTools.PowerShell.dll" "CustomPSSnapInType"="Microsoft.TeamFoundation.PowerTools.PowerShell.TFPSSnapIn"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\PowerShell\PowerShellSnapIns\Microsoft.TeamFoundation.PowerShell] "PowerShellVersion"="4.0" "Vendor"="Microsoft Corporation" "Description"="This is a PowerShell snap-in that includes the Team Foundation Server cmdlets." "VendorIndirect"="Microsoft.TeamFoundation.PowerShell,Microsoft" "DescriptionIndirect"="Microsoft.TeamFoundation.PowerShell,This is a PowerShell snap-in that includes the Team Foundation Server cmdlets." "Version"="14.0.0.0" "ApplicationBase"="C:\Program Files (x86)\Microsoft Team Foundation Server 2010 Power Tools" "AssemblyName"="Microsoft.TeamFoundation.PowerTools.PowerShell, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" "ModuleName"="C:\Program Files (x86)\Microsoft Team Foundation Server 2015 Power Tools\Microsoft.TeamFoundation.PowerTools.PowerShell.dll" "CustomPSSnapInType"="Microsoft.TeamFoundation.PowerTools.PowerShell.TFPSSnapIn"

不要忘记根据您的设置更改 PowerShellVersion 和 TFS 版本。如果版本不匹配,它将无法工作。 我从 http://www.it1me.com/it-answers?id=35292971&ttl=TFS+Build%3A+%60Microsoft.TeamFoundation.PowerShell%26%2339%3B+is+not+installed+on+this+computer

找到的