我正在尝试从Powershell队列中指定进程参数的队列 . 我收到以下错误...任何想法我做错了什么?
无法找到类型 [Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers]
:确保已加载包含此类型的程序集 .
At line:19 char:1
$ paramValues = [Microsoft.TeamFoundation.Build.Workflow.WorkflowHelpers] :: Deseri ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~分类信息: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")
1 回答
不在GAC!您需要将dll添加到GAC或尝试此操作