我正在编写自定义的构建过程模板,并面临以下与输入参数的值相关的问题。请帮忙。
- 克隆 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)); }
但结果是 EMPTY 或 NULL。
最佳答案
通过再次重新映射客户事件的模板变量和输入参数,该问题已得到解决。
步骤如下: - 右键单击刚刚添加到模板中的自定义事件 - 将自定义事件的输入参数映射到模板中声明的变量
关于c# - 如何获取构建过程模板中的参数值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20798039/