c# - 如何获取构建过程模板中的参数值

标签 c# tfs build build-process

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

  1. 克隆 StandardTemplate.xml 并重命名为 CustomTemplate.xml
  2. 添加名为 BatFileLocation 的新参数
  3. 尝试显示 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));
    } 
    

但结果是 EMPTY 或 NULL。

最佳答案

通过再次重新映射客户事件的模板变量和输入参数,该问题已得到解决。

步骤如下: - 右键单击​​刚刚添加到模板中的自定义事件 - 将自定义事件的输入参数映射到模板中声明的变量

关于c# - 如何获取构建过程模板中的参数值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20798039/

相关文章:

git - 使用源代码管理功能时,Visual Studio 2013 速度变慢 + 崩溃

eclipse - Run 不会在 Eclipse 中构建引用的项目

maven - Jenkins 和 maven-buildnumber-plugin

json - 使用gradle任务更新json文件中的 token

c# - 将所有警告视为错误

visual-studio - visual studio 2017 搜索 tfs 变更集评论

c# - 在 n 列之间划分内容的最佳方法是什么?

c# - ExecuteScalar 找不到存储过程

c# - 为什么使用 `foreach` 循环数组对象比 lambda `ForEach` 更快?

c# - C#中的字符串字符差异