public override IEnumerable <BuildResult> Build() { var currentDirectory = _environment.CurrentDirectory; ProjectFiles.Clear(); if (Project.Count() > 0) { foreach (var proj in Project) { // hacky to account for win32 / unix fs differences var projectSpec = proj; if (System.IO.Path.DirectorySeparatorChar != '\\' && projectSpec.Contains('\\')) { projectSpec = projectSpec.Replace("\\", Path.DirectorySeparatorChar + ""); } var pathSpec = _environment.DescriptorFile.Parent.Path.Combine(projectSpec).FullPath; IEnumerable <IFile> specFiles; // TODO: Fix OFS. Horribe construction, the Files extension method seems to be buggy as f**k. try { specFiles = _fileSystem.Files(pathSpec); } catch (Exception) { specFiles = GetWildcardFile(pathSpec); } if (specFiles.Any() == false) { specFiles = GetWildcardFile(pathSpec); } if (specFiles.Any() == false || specFiles.Any(x => x.Exists == false)) { yield return(new UnknownProjectFileResult(proj)); yield break; } ProjectFiles.AddRange(specFiles); } } else { var sourceDirectory = currentDirectory.GetDirectory("src"); if (!sourceDirectory.Exists) { yield return (new ErrorBuildResult(string.Format("Could not locate a /src folder in current directory '{0}'. Make sure you use the default layout for project code.", _environment.CurrentDirectory.Path.FullPath))); yield break; } ProjectFiles.AddRange(sourceDirectory.Files("*.*proj", SearchScope.SubFolders)); } var builds = from file in ProjectFiles from platform in Platform.DefaultIfEmpty(null) from profile in Profile.DefaultIfEmpty(null) select new { file, platform, profile }; yield return(new TextBuildResult(string.Format("Using MSBuild from path '{0}'.", ExecutablePath))); if (!Incremental) { foreach (var project in builds) { using (var responseFile = _fileSystem.CreateTempFile()) { foreach (var value in ExecuteEngine(CreateMSBuildProcess(responseFile, project.file, project.platform, project.profile, "Clean"))) { yield return(value); } } } } foreach (var project in builds) { using (var responseFile = _fileSystem.CreateTempFile()) { var msbuildProcess = CreateMSBuildProcess(responseFile, project.file, project.platform, project.profile, "Build"); yield return(new InfoBuildResult(string.Format("Building '{0}'...", project.file.Path.FullPath))); foreach (var m in ExecuteEngine(msbuildProcess)) { yield return(m); } } } }