2017-07-25 53 views
0

我已經將團隊基礎動力工具安裝到Jenkins服務器。我已經安裝了Full VS 2015的TFS 2015.我想運行從TFS中拉出項目的powershell腳本。我能夠從Jenkins服務器運行它。當我嘗試從詹金斯傳遞腳本使用PowerShell插件構建定義。我收到有關Team Foundation電源工具的錯誤。詹金斯抱怨沒有安裝團隊基礎動力工具。我試圖卸載並重新安裝工具。我的Jenkins服務正在運行,使用我安裝此工具。另外,這個工具不是用戶特定的。它爲所有用戶安裝。有人可以幫忙嗎?團隊基礎動力工具沒有被詹金斯認可,即使它已經安裝到它

Add-PSSnapin:此計算機上未安裝Windows PowerShell管理單元「Microsoft.TeamFoundation.PowerShell」。 在C:\ Users \ AppData \ Local \ Temp \ jenkins4325377511943060199.ps1:22 char:1 + Add-PSSnapin Microsoft.TeamFoundation.PowerShell + ~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:InvalidArgument:(Microsoft.TeamFoundation.PowerShell:String)[Add-PSSnapin ],PSArgument 異常 + FullyQualifiedErrorId:AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand GET-TfsChildItem:術語 'GET-TfsChildItem' 不被識別爲 cmdlet,函數,腳本文件或可操作的程序的名稱。 檢查名稱的拼寫,或者如果包含路徑,請驗證路徑是否正確,然後重試。在 C:\用戶\應用程序數據\本地的\ Temp \ jenkins4325377511943060199.ps1:25 焦炭:10 + $項目= GET-TfsChildItem $ AutoDeployDir -Recurse -Server $ tfsCollection + ~~~~~~~~~~ ~~~~~~ + CategoryInfo:ObjectNotFound:(GET-TfsChildItem:字符串)[],CommandNotFoundException + FullyQualifiedErrorId:CommandNotFoundException

enter image description here ,你可以看到,我可以在服務器內部手動運行它。

+0

它工作,如果你手動運行在Jenkins服務器上的PowerShell腳本? –

+1

是的,它工作完美。所以,我很困惑它可能是什麼?我只是更新了問題中的錯誤。它在第一行中說「Add-PSSnapin:此計算機上未安裝Windows PowerShell管理單元」Microsoft.TeamFoundation.PowerShell「。」 – Meet101

回答

0

我想通了。這是x32和x64之間的工具問題。您將需要添加註冊表來解決此問題。在* .reg文件中複製下面的內容,然後雙擊文件將其安裝到註冊表中。

Windows註冊表編輯器版本5。00 [HKEY_LOCAL_MACHINE \ SOFTWARE \微軟\ PowerShell的\ 1 \ PowerShellSnapIns \ Microsoft.TeamFoundation.PowerShell] 「PowerShellVersion」= 「4.0」, 「供應商」= 「微軟公司」 「描述」=「這是一個PowerShell管理單元其中包括團隊 Foundation Server cmdlet。「 「VendorIndirect」= 「Microsoft.TeamFoundation.PowerShell,微軟」 「DescriptionIndirect」= 「Microsoft.TeamFoundation.PowerShell,這是一個 PowerShell管理單元,其中包括在Team Foundation Server的cmdlet。」 「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 \微軟\ PowerShell的\ 1 \ PowerShellSnapIns \ Microsoft.TeamFoundation.PowerShell] 」 鮑威rShellVersion「=」4.0「」Vendor「=」Microsoft Corporation「 」Description「=」這是一個包含團隊 Foundation Server cmdlet的PowerShell管理單元。「 「VendorIndirect」=「Microsoft.TeamFoundation.PowerShell,Microsoft」 「DescriptionIndirect」=「Microsoft.TeamFoundation.PowerShell,這是包含Team Foundation Server cmdlet的 PowerShell管理單元。」 「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,文化=中性公鑰= b03f5f7f11d50a3a 「 」模塊名「= 」C:\ Program Files文件(x86)的\微軟的Team Foundation服務器 2015年電力 工具\ 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

0

根據錯誤

附加PSSnapin:在Windows PowerShell管理單元 'Microsoft.TeamFoundation.PowerShell' 未安裝此 計算機上。

可能TFS Powertools沒有完全安裝。默認情況下,它不會安裝PS CmdLets

enter image description here

所以,簡單的添加在安裝的過程中,然後再次嘗試與詹金斯的構建。

enter image description here

更多方法請參考這個類似的問題:TFS Build: `Microsoft.TeamFoundation.PowerShell' is not installed on this computer

+0

我知道這一點,並在安裝時做過這些。正如我提到它在Jenkins服務器上手動工作,但不與Jenkins一起構建定義/ PowerShell插件 – Meet101

+0

@ Meet101很高興在這裏修復了這個問題。您的解決方案和鏈接與我上面提供的相同。對不起,我注意到這也可能是32位和64位PowerShell的問題。沒有明確表達,只是在一個簡短的調查中說了更多的方法。 –