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(
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。通过重新映射客户活动的模板和输入参数变量,问题已得到解决 步骤如下: -右键单击刚添加到模板中的自定义活动 -使用模板中声明的变量映射自定义活动的输入参数