Suppose there is a project with a complex hierarchy.
Is it possible to get the source code of the entire project in VISUAL STUDIO without clicking on all the files in the project?
Suppose there is a project with a complex hierarchy.
Is it possible to get the source code of the entire project in VISUAL STUDIO without clicking on all the files in the project?
Try to do this:
string rootPath = @"path you your root folder"; var header = "***********************************" + Environment.NewLine; var files = Directory.GetFiles(rootPath, "*.cs", SearchOption.AllDirectories); var result = files.Select(path => new { Name = Path.GetFileName(path), Contents = File.ReadAllText(path)}) .Select(info => header + "Filename: " + info.Name + Environment.NewLine + header + info.Contents); var singleStr = string.Join(Environment.NewLine, result); Console.WriteLine ( singleStr ); File.WriteAllText(@"C:\output.txt", singleStr, Encoding.UTF8); Once helped. Found it here: https://stackoverflow.com/questions/15546733/how-to-export-all-the-source-code-from-visual-studio-into-a-text-file
Source: https://ru.stackoverflow.com/questions/525001/
All Articles