Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在生成过程模板中获取参数值_C#_Tfs_Build_Build Process - Fatal编程技术网

C# 如何在生成过程模板中获取参数值

C# 如何在生成过程模板中获取参数值,c#,tfs,build,build-process,C#,Tfs,Build,Build Process,我正在编写定制的构建过程模板,并面临如下与输入参数值相关的问题。请帮忙 克隆了StandardTemplate.xml并重命名为CustomTemplate.xml 添加名为BatFileLocation的新参数 尝试显示BatFileLocation的参数值,如下代码所示 //定义字符串类型的活动输入参数 public InArgument<string> BatFileLocation { set; get; } protected override void Execute(

我正在编写定制的构建过程模板,并面临如下与输入参数值相关的问题。请帮忙

  • 克隆了StandardTemplate.xml并重命名为CustomTemplate.xml
  • 添加名为BatFileLocation的新参数
  • 尝试显示BatFileLocation的参数值,如下代码所示

    //定义字符串类型的活动输入参数

    public InArgument<string> BatFileLocation { set; get; }
    
    protected override void Execute(CodeActivityContext context)
    {
        // Obtain the runtime value of the Text input argument
        string text = context.GetValue(this.BatFileLocation);
        context.TrackBuildWarning(string.Format("Trigger the {0}", text));
    } 
    
    public-inagramentbatfilelocation{set;get;}
    受保护的覆盖无效执行(CodeActivityContext上下文)
    {
    //获取文本输入参数的运行时值
    string text=context.GetValue(this.BatFileLocation);
    TrackBuildWarning(string.Format(“触发{0}”,text));
    } 
    

  • 但是结果为空或NULL。

    通过重新映射客户活动的模板和输入参数变量,问题已得到解决

    步骤如下: -右键单击刚添加到模板中的自定义活动 -使用模板中声明的变量映射自定义活动的输入参数