We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6bf2e19 commit b100dfbCopy full SHA for b100dfb
source/Nuke.Tooling/ToolTasks.Run.cs
@@ -99,4 +99,14 @@ protected virtual IProcess StartProcess(
99
logger,
100
outputFilter);
101
}
102
+
103
+ public static T Resolve<T>()
104
+ where T : ToolTasks
105
+ {
106
+ var applicableTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(x => x.GetTypes())
107
+ .Where(x => x.IsAssignableTo(typeof(T)))
108
+ .OrderByDescending(x => x.Descendants(x => x.BaseType).Count());
109
+ var mostDerivedType = applicableTypes.First();
110
+ return mostDerivedType.CreateInstance<T>();
111
+ }
112
0 commit comments