public void CanRoundTripSolutionFile() { var parser = new SolutionFileParser(); var solutionFile = parser.Parse(new FilePath ("c:\\x.sln", false), iocSolutionJan2010.AsLines()); var roundTripped = string.Join(Environment.NewLine, solutionFile.Lines().ToArray()) + Environment.NewLine; Assert.That(roundTripped, Is.EqualTo(iocSolutionJan2010), "Roundtripping loading the solution should not have changed it at all."); }
public void CanRoundTripSolutionFile() { var parser = new SolutionFileParser(new FakeFileSystem()); var solutionFile = parser.Parse(new FilePath ("c:\\x.sln", false), iocSolutionJan2010.AsLines()); var roundTripped = ToSolutionString(solutionFile.Lines()); Assert.That(roundTripped, Is.EqualTo(iocSolutionJan2010), "Roundtripping loading the solution should not have changed it at all."); }
public void CanFindProjectConfigurationSections() { var parser = new SolutionFileParser(new FakeFileSystem()); var solution = parser.Parse(new FilePath("c:\\x.sln", false), iocSolutionJan2010.AsLines()); Assert.IsNotNull(solution.Globals); Assert.IsNotNull(solution.Globals.ProjectConfigurationPlatforms); Assert.IsNotNull(solution.Globals.SolutionConfigurationPlatforms); }
private void ParseSolutionFileProjects(Dictionary <string, List <string> > sharedProjects, List <ProjectFileParser> projects) { var solution = new SolutionFileParser(File.ReadAllLines(SolutionPath)); foreach (var projectLine in solution.Projects.Select(l => l.Replace(" ", string.Empty)).Where(l => l.StartsWith("Project(\"{"))) { var projectName = projectLine.SubstringByString("=\"", "\",\""); var projectRelativePath = projectLine.SubstringByString(",\"", "\",\""); var path = Path.Combine(Path.GetDirectoryName(SolutionPath) ?? "", projectRelativePath); if (projectLine.Contains(ProjectInfo.GetTypeId(ProjectInfo.ProjectType.SharedProj))) { var files = File.ReadAllLines(path.Substring(0, path.Length - "shproj".Length) + "projitems") .Where(l => l.Contains("<Compile Include=\"$(MSBuildThisFileDirectory)")) .Select(l => l.SubstringByString("<Compile Include=\"$(MSBuildThisFileDirectory)", "\"")) .ToList(); sharedProjects.Add(projectName, files); } else if (projectLine.Contains(ProjectInfo.GetTypeId(ProjectInfo.ProjectType.CsProj))) { projects.Add(new ProjectFileParser(File.ReadAllLines(path))); } } }
private List <SolutionProjectItem> GetSolutionFileItems(string solutionFile) { var solution = SolutionFileParser.ParseSolutionFile(solutionFile); return(solution.GetSortedHierarchy()); }
public static void ClassInit(TestContext testContext) { _solutionFile = SolutionFileParser.Parse(new SolutionFileInfo(@"D:\GitHub\SolutionAndProjects\SolutionAndProjects\SolutionAndProjects.sln")); }
public void getSolutionGuid_Returns_Null_On_NonExisting_Solution_Path() { string actualSolutionGuid = SolutionFileParser.getSolutionGuid(@"C:\\Random\\Path\\Invalid\\Solution.sln"); Assert.AreEqual(null, actualSolutionGuid); }
public static ExternalSolutionApi GetSolutionFile(string path) { var parser = new SolutionFileParser(); var filePath = new FilePath(path, false); return new ExternalSolutionApi(parser.Parse(filePath, filePath.FileContent().AsLines())); }