public CsProjFile csprojFor(string name) { var files = new FileSystem().FindFiles(Environment.CurrentDirectory, FileSet.Deep(name + ".csproj")); if (files.Count() == 0) { Assert.Fail("Project {0} could not be found".ToFormat(name)); } return CsProjFile.LoadFrom(files.Single()); }
public static Project ReadFrom(string file) { var project = new Project(file); project._nugetDependencies.AddRange(NugetDependency.ReadFrom(file)); var files = new FileSystem().FindFiles(file.ParentDirectory(), new FileSet(){ Include = "*.csproj" }); var csProjFile = files.FirstOrDefault(); if (files.Count() > 1) { csProjFile = files.FirstOrDefault(x => x.StartsWith(project.ProjectName)); } project.ProjectFile = csProjFile; return project; }
public static string FindSolutionFile() { var currentDirectory = Environment.CurrentDirectory.ToFullPath(); var files = new FileSystem().FindFiles(currentDirectory, FileSet.Deep("*.sln")); if (files.Count() == 1) { return Path.GetFileName(files.Single()); } if (files.Any()) { ConsoleWriter.Write(ConsoleColor.Yellow, "Found more than one *.sln file:"); files.Each(x => ConsoleWriter.Write(ConsoleColor.Yellow, x)); ConsoleWriter.Write(ConsoleColor.Yellow, "You need to specify the solution with the --solution flag"); } else { ConsoleWriter.Write(ConsoleColor.Yellow, "Could not find any *.sln files"); } return null; }