有反正擺脫IBuildDefinition或其他相關的「服務」集合URI。TFS自定義生成模板 - 獲取團隊項目集合不開放的
我想避免必須將uri作爲自定義參數提供給構建模板中的集合。我正在尋找一種方法來從UITypeEditor自定義類中(在此例中)以編程方式檢索它。
有沒有辦法查詢這個,而不訴諸硬編碼?在我看來,構建過程本身(定義,控制器,代理等)知道他們正在處理哪個集合,但我怎麼能找到?
更新:這是從UITypeEditor繼承時的示例代碼。然後你只需訪問VersionControlService的TeamProjectCollection屬性:
public class Editor : UITypeEditor
{
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
{
if (provider != null)
{
IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
if (service != null)
{
VersionControlServer vcs = provider.GetService(typeof(VersionControlServer)) as VersionControlServer;
// Do what you need to do with it here
}
return value;
}
public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
return UITypeEditorEditStyle.Modal;
}
返回'null'我:( – Gene 2013-01-24 09:35:05
我發佈的代碼的樣本得到它在更新以上 – 2013-01-24 14:56:29
非常感謝你的努力。看來,如果您引用TFS 2010組件這不起作用和編輯在VS 2012的構建定義(我們使用TFS 2010服務器)。在VS 2010中它像一個魅力。 – Gene 2013-01-24 15:08:13