C# TFS-链接构建-如何将信息从一个构建传递到下一个构建?

C# TFS-链接构建-如何将信息从一个构建传递到下一个构建?,c#,xaml,tfs,workflow-foundation,tfsbuild,C#,Xaml,Tfs,Workflow Foundation,Tfsbuild,我正在开发一个TFS构建定义,该定义通过使用此处的blog代码启动另一个构建: 我对文章底部的前几条评论感兴趣。基本上,我只想将第一个版本号传递到下一个版本 将XAML模板更改为通过而不是 更棘手的是将当前版本号添加到新的IBuildRequest的ProcessParameters 我可以看到如何使用上面的的默认属性添加代码行,但似乎每行都必须返回一些内容。但是我想运行的一些行只调用一个没有返回值的方法,例如,在ProcessParameters字典中添加新元素时。这是我试过的 所以,

我正在开发一个TFS构建定义,该定义通过使用此处的blog代码启动另一个构建:

我对文章底部的前几条评论感兴趣。基本上,我只想将第一个版本号传递到下一个版本

将XAML模板更改为通过而不是


更棘手的是将当前版本号添加到新的
IBuildRequest
ProcessParameters

我可以看到如何使用上面的
默认属性添加代码行,但似乎每行都必须返回一些内容。但是我想运行的一些行只调用一个没有返回值的方法,例如,在
ProcessParameters
字典中添加新元素时。这是我试过的


所以,我的第一个问题。。。是否可以在序列变量中运行没有返回值的代码行

我对这些技术很陌生,所以可能错过了一些基本的东西。如果有人有不同的方法将上一个版本号传递给下一个版本,那也将非常感谢

如果你能走到这一步,非常感谢:-)

感谢他原创的博文,并将我引向活动。在卓越的帮助下,我更新了XAML,如下所示:

<Sequence DisplayName="Queue chained build" sap:VirtualizedContainerService.HintSize="222,146">
    <Sequence.Variables>
        <Variable x:TypeArguments="mtbc:IBuildDefinition" Default="[BuildServer.GetBuildDefinition(BuildDetail.TeamProject, buildChainItem)]" Name="ChainedBuildDefinition" />
        <Variable x:TypeArguments="mtbc:IBuildRequest" Default="[BuildServer.CreateBuildRequest(ChainedBuildDefinition.Uri)]" Name="ChainedBuildRequest" />
        <Variable x:TypeArguments="x:String" Default="[ChainedBuildRequest.ProcessParameters]" Name="NextBuildProcessParameters" />
        <Variable x:TypeArguments="scg:IDictionary(x:String, x:Object)" Default="[WorkflowHelpers.DeserializeProcessParameters(NextBuildProcessParameters)]" Name="DeserializedParameters" />
        <Variable x:TypeArguments="mtbc:IQueuedBuild" Name="QueuedChainedBuild" />
    </Sequence.Variables>

    <sap:WorkflowViewStateService.ViewState>
        <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
        </scg:Dictionary>
    </sap:WorkflowViewStateService.ViewState>

    <InvokeMethod DisplayName="Add current build number to ProcessParameters" sap:VirtualizedContainerService.HintSize="299.663333333333,127.553333333333" MethodName="Add">
        <InvokeMethod.TargetObject>
            <InArgument x:TypeArguments="scg:IDictionary(x:String, x:Object)">[DeserializedParameters]</InArgument>
        </InvokeMethod.TargetObject>
        <InArgument x:TypeArguments="x:String">["ParentBuildNumber"]</InArgument>
        <InArgument x:TypeArguments="x:Object">[BuildDetail.BuildNumber]</InArgument>
    </InvokeMethod>

    <InvokeMethod DisplayName="Re-serialize ProcessParameters" sap:VirtualizedContainerService.HintSize="299.663333333333,127.553333333333" MethodName="SerializeProcessParameters" TargetType="mtbw:WorkflowHelpers">
        <InvokeMethod.Result>
            <OutArgument x:TypeArguments="x:String">[ChainedBuildRequest.ProcessParameters]</OutArgument>
        </InvokeMethod.Result>
        <InArgument x:TypeArguments="scg:IDictionary(x:String, x:Object)">[DeserializedParameters]</InArgument>
    </InvokeMethod>

    <InvokeMethod DisplayName="Queue Next Build" sap:VirtualizedContainerService.HintSize="299.663333333333,127.553333333333" MethodName="QueueBuild">
        <InvokeMethod.Result>
            <OutArgument x:TypeArguments="mtbc:IQueuedBuild">[QueuedChainedBuild]</OutArgument>
        </InvokeMethod.Result>
        <InvokeMethod.TargetObject>
            <InArgument x:TypeArguments="mtbc:IBuildServer">[BuildServer]</InArgument>
        </InvokeMethod.TargetObject>                      
        <InArgument x:TypeArguments="mtbc:IBuildRequest">[ChainedBuildRequest]</InArgument>
    </InvokeMethod>

    <mtbwa:WriteBuildMessage sap:VirtualizedContainerService.HintSize="200,22" Importance="[Microsoft.TeamFoundation.Build.Client.BuildMessageImportance.High]" Message="[String.Format(&quot;Queued chained build '{0}'&quot;, buildChainItem)]" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" />
 </Sequence>

真的
[反序列化参数]
[“ParentBuildNumber”]
[BuildDetail.BuildNumber]
[ChainedBuildRequest.ProcessParameters]
[反序列化参数]
[QueuedChainedBuild]
[构建服务器]
[链接构建请求]

您可以尝试InvokeMethod活动:谢谢Jason。看起来很有希望。我很快就会试试的。这本书中有一些很好的例子