找不到类型[Microsoft.TeamFoundation.Client.TeamFoundationServerFactory] [英] Unable to find type [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]
问题描述
我正在尝试将TFS上的构建放在一起,通过使用同事编写并曾经使用过的PowerShell脚本在不同的TFS集合中启动另一个构建.但是,此脚本是在VS 2015 Professional上编写和测试的,我正在使用2017 Enterprise.当我在构建中运行此脚本时,出现以下错误:
I am trying to put a build together on TFS that starts another build within a different TFS collection by using a PowerShell script that a coworker wrote and had working previously. However, this script was written and tested on VS 2015 Professional and I am using 2017 Enterprise. When I go to run this script in my build I get the following error:
Unable to find type [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]
点击时:
$tfs = [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]::GetServer($serverName)
我已经浏览了C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer
中的.dll,但找不到该dll(也许特定于Professional 2015?)
I have looked through the .dlls in C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer
but cannot find this dll (maybe specific to Professional 2015?)
我将如何解决这个问题?从我的研究看来,我需要将dll添加到GAC,但不确定要添加哪个dll.如果此dll与Enterprise 2017没有关联,我如何更改此行以使其与我的版本一起使用?
How would I go about solving this issue? From my research it seems like I need to add the dll to the GAC, but not sure which dll to add. If this dll is not associated with Enterprise 2017, how would I change this line to work with my version?
推荐答案
对象模型客户端库不在GAC中.
The object model client libraries are not in GAC.
添加要通过Add-Type
cmdlet加载的dll,如下所示:(在您的方案中,您需要添加Microsoft.TeamFoundation.Client.dll
)
Add the dll to load by Add-Type
cmdlet like below: (In your scenario you need to add Microsoft.TeamFoundation.Client.dll
)
$visualStudiopath = 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer'
Add-Type -Path "$visualStudiopath\Microsoft.TeamFoundation.VersionControl.Client.dll"
Add-Type -Path "$visualStudiopath\Microsoft.TeamFoundation.Common.dll"
Add-Type -Path "$visualStudiopath\Microsoft.TeamFoundation.WorkItemTracking.Client.dll"
Add-Type -Path "$visualStudiopath\Microsoft.TeamFoundation.Client.dll"
Add-type -path "$visualStudiopath\Microsoft.TeamFoundation.ProjectManagement.dll"
Add-Type -Path "$visualStudiopath\Microsoft.TeamFoundation.Build.Common.dll"
这篇关于找不到类型[Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!