protected override BuildResult Build(IProgressMonitor monitor, IBuildTarget item, ConfigurationSelector configuration) { BuildResult res; if (item is SolutionEntityItem) { SolutionEntityItem entry = (SolutionEntityItem)item; SolutionItemConfiguration conf = entry.GetConfiguration(configuration) as SolutionItemConfiguration; if (conf != null && conf.CustomCommands.HasCommands(CustomCommandType.Build)) { conf.CustomCommands.ExecuteCommand(monitor, entry, CustomCommandType.Build, configuration); res = new BuildResult(); } else { res = entry.OnBuild(monitor, configuration); } } else if (item is WorkspaceItem) { res = ((WorkspaceItem)item).OnRunTarget(monitor, ProjectService.BuildTarget, configuration); } else if (item is SolutionItem) { res = ((SolutionItem)item).OnBuild(monitor, configuration); } else { throw new InvalidOperationException("Unknown item type: " + item); } if (res != null) { res.SourceTarget = item; } return(res); }