private ProjectFileAnalyzerResult LocateCsproj(string location) { ProjectFileAnalyzerResult result = new ProjectFileAnalyzerResult(); if (location == null) { if (_file.Exists("./.flubu")) { var lines = _file.ReadAllLines("./.flubu"); if (lines.Count > 1 && !string.IsNullOrEmpty(lines[1]) && _file.Exists(lines[1])) { result.ProjectFileFound = true; result.ProjectFileLocation = Path.GetFullPath(lines[1]); return(result); } } foreach (var defaultCsprojLocation in _defaultCsprojLocations) { if (_file.Exists(defaultCsprojLocation)) { result.ProjectFileFound = true; result.ProjectFileLocation = Path.GetFullPath(defaultCsprojLocation); return(result); } var defaultCsprojLocationSrc = Path.Combine("src", defaultCsprojLocation); if (_file.Exists(defaultCsprojLocationSrc)) { result.ProjectFileFound = true; result.ProjectFileLocation = Path.GetFullPath(defaultCsprojLocationSrc); return(result); } } var flubuFile = _buildScriptLocator.FindFlubuFile(); if (string.IsNullOrEmpty(flubuFile)) { return(result); } var flubuFileLines = _file.ReadAllLines(flubuFile); if (flubuFileLines.Count > 1 && !string.IsNullOrEmpty(flubuFileLines[1])) { var flubuFileDir = Path.GetDirectoryName(flubuFile); var buildCsprojPath = Path.Combine(flubuFileDir, flubuFileLines[1]); result.ProjectFileFound = true; result.ProjectFileLocation = buildCsprojPath; } else { //// empty flubu file or csproj location is not set in flubu file. Search in default locations relative to .flubu file. foreach (var defaultCsprojLocation in _defaultCsprojLocations) { var flubuFileDirectory = Path.GetDirectoryName(flubuFile); var csprojLocation = Path.Combine(flubuFileDirectory, defaultCsprojLocation); if (_file.Exists(csprojLocation)) { result.ProjectFileFound = true; result.ProjectFileLocation = Path.GetFullPath(csprojLocation); return(result); } } } } else { if (_file.Exists(location)) { result.ProjectFileFound = true; result.ProjectFileLocation = location; } } return(result); }