无法找到类型 [Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers] [英] Unable to find type [Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers]

查看:24
本文介绍了无法找到类型 [Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 Powershell 指定进程参数对构建进行排队.我收到以下错误...知道我做错了什么吗?

I'm trying to queue a build from Powershell specifying Process Parameters. I'm getting the following error ... any ideas what I'm doing wrong?

无法找到类型 [Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers]:确保加载了包含此类型的程序集.

Unable to find type [Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers]: make sure that the assembly containing this type is loaded.

在第 19 行字符:1
+ $paramValues = [Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers]::Deseri ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (Microsoft.TeamF...WorkflowHelpers:TypeName) [], RuntimeException
+ FullQualifiedErrorId : TypeNotFound`

At line:19 char:1
+ $paramValues = [Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers]::Deseri ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (Microsoft.TeamF...WorkflowHelpers:TypeName) [], RuntimeException
+ FullyQualifiedErrorId : TypeNotFound`

    function Get-BuildServer
        {
        param($serverName = $(throw 'please specify a TFS server name'))
        [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Client")
        [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Build.Client")
        $tfs = [Microsoft.TeamFoundation.Client.TeamFoundationServerFactory]::GetServer($serverName)

        return $tfs.GetService([Microsoft.TeamFoundation.Build.Client.IBuildServer])
        }

    # SAS: Get the Build Server
    $buildserver = Get-BuildServer "http://tfsserver:8080/tfs/My%20Project%20Collection"

    # SAS: Set the parameters (Team Project and Build Definition)
    $teamProject = "MyProject"
    $buildDefinition = "MyBuildDefinition"

    # SAS: Get the build definition
    $definition = $buildserver.GetBuildDefinition($teamProject, $buildDefinition)

    # SAS: Create the build request
    $request = $definition.CreateBuildRequest()

    # SAS: Deserialise the Process Parameter for the Build Definition
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.TeamFoundation.Build.Workflow")
    $paramValues = [Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers]::DeserializeProcessParameters($request.ProcessParameters)

    # SAS: Set the parameter(s)
    $paramValues.Item("asdf") = "new value"

    # SAS: Serialise the Process Parameter for the Build Definition
    $request.ProcessParameters = [Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers]::SerializeProcessParameters($paramValues)

    # SAS: Queue the build
    $buildserver.QueueBuild($request, "None") 

推荐答案

不在 GAC 中!您需要将dll添加到GAC或者试试这个

not in the GAC! You need to add dll to GAC or try this

add-type -Path 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.Build.Workflow.dll'

这篇关于无法找到类型 [Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆