TFS Build:此计算机上未安装`Microsoft.TeamFoundation.PowerShell'

问题描述 投票:7回答:3

当我使用本地帐户登录到tfs构建服务器并执行以下powershell命令时:

Add-PSSnapin Microsoft.TeamFoundation.PowerShell

它正确加载tfs cmdlet。但是,当我在调用脚本的tfs服务器上触发构建时,它会失败并显示以下消息:

此计算机上未安装“Microsoft.TeamFoundation.PowerShell”。

构建代理在服务帐户下运行。我该怎么办?

编辑:我必须编辑@Alexis Coles答案中第一个链接的注册表项,使其适用于TFS Power Tools 2015版:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\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 2015 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\1\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 2015 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"

仔细检查AssemblyNameApplicationBaseModuleNameVersion条目。上面的脚本适用于Microsoft Team Foundation Server 2015 Power Tools

powershell tfs tfsbuild build-automation tfs-power-tools
3个回答
3
投票

我将在这里快速发布并说它可能与32位与64位PowerShell有关。如果我从正常的64位PowerShell运行Add-PSSnapinicrosoft.TeamFoundation.PowerShell罚款。但是,如果我从C:\ Windows \ SysWOW64 \ WindowsPowerShell \ v1.0 \ powershell_ise.exe运行它我得到上述异常。我将继续说,构建服务器是一个32位应用程序,并在那里启动32位运行时。

不确定修复的确切内容,但以下内容可能会指向正确的方向。

PowerShell (2.0, 32-bit) can't load TFS 2010 snap-in... except when it can

https://social.msdn.microsoft.com/Forums/en-US/a116799a-0476-4c42-aa3e-45d8ba23739e/tfs-power-tools-2008-powershell-snapin-wont-run-in-on-64bit-in-windows-2008-r2?forum=tfspowertools


9
投票

我遇到了这个问题,为了解决这个问题,我注意到默认情况下,在PowerTools安装过程中不会添加cmdlet。您需要运行完整安装才能使其正常运行。

我在这里贴了一些照片:https://fabiostawinski.wordpress.com/2016/07/11/the-windows-powershell-snap-in-microsoft-teamfoundation-powershell-is-not-installed-on-this-computer/


0
投票

对我来说这是另一个问题,因为我试图使用只安装了Visual Studio 2017 Pro的Power Tools。

对于Visual Studio 2017,他们没有发布Microsoft Team Foundation Server 2017 Power Tools。他们说以前的版本应该适用于任何具有TFS的Visual Studio的更高版本。

问题是,如果您只安装了Visual Studio 2017,则无法安装Microsoft Team Foundation Server 2015 Power Tools,因为安装Visual Studio 2015(任何版本)是安装Microsoft Team Foundation Server 2015 Power Tools的要求。

换句话说,我必须安装Visual Sudio 2015然后安装Microsoft Team Foundation Server 2015 Power Tools然后Add-PSSnapin Microsoft.TeamFoundation.PowerShell工作。

请参阅:https://developercommunity.visualstudio.com/content/problem/103642/team-foundation-server-2015-power-tools-install-is.html

希望这会对某人有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.