TFS 构建定义下拉菜单

TFS Build Definition Dropdown Menu

VS2012 TFS2012

我按照 this 简单指南在构建定义中创建下拉菜单。我的目标是有两个下拉列表,一个有 20 个 select 离子并且能够 select 多个选项,第二个有 70 个并且只选择一个。

向枚举添加两个以上的选项后,selecting 和 deselecting 无法正常工作。例如:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Workflow.ActivityHelpers
{
public enum Enums
    {

        Internal,
        Public,
        Failed,
        Another,
        YetAnother
    }
}

I select Another and Internal deselects 和 Public and Failed selects。每次点击我都会得到 selected\unselected 选项的不同组合。

编辑: 添加图片 打开下拉菜单 只有 Internal2 是 selected(太低代表 post 超过 2 个链接) 点击另一个 link 现在有 3 个 selected。

参考其他post回答。

指南正在使用 "if... then... else"。这适合两种选择。请更改为正确的代码。并确定支持多选的变量类型

我最终做的是这样的: custom type for an argument

我需要获取数据 XML。对于多项选择,我使用了从 xml 部分创建的动态复选框。对于单一选择,我选择了组合框。

重要说明。要真正完成这项工作并构建读取数据,您需要更改

return值;

 class CredentialEditor : UITypeEditor 
{ 

    public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) 
    { 
        string selected = null;
        if (provider != null) 
        { 
            IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); 

            if (editorService != null) 
            { 
                Credential credential = value as Credential; 

                using (CredentialDialog dialog = new CredentialDialog()) 
                { 
                    dialog.UserName = credential.UserName; 
                    dialog.Password = credential.Password; 

                    if (editorService.ShowDialog(dialog) == DialogResult.OK) 
                    { 
                        credential.UserName = dialog.UserName; 
                        credential.Password = dialog.Password; 
                        selected = dialog.UserName
                    } 
                } 
            } 

        } 

        return new Credentials() { UserName = selected}; 

    }