In this recipe, we wrote a C# console application based on Roslyn Workspaces API to format and simplify all the source files in a solution. These operations are very similar to what a Visual Studio IDE would do when you apply formatting and simplification quick fixes after setting the corresponding tools options. Let's walk through the code and understand how we implemented these operations:
public static void Main(string[] args){ // Parse arguments to get solution. var slnPath = ParseArguments(args); if (slnPath == null) { return; } // Create workspace. MSBuildWorkspace workspace = MSBuildWorkspace.Create(); // Open solution within the workspace. Console.WriteLine($"Loading solution '{slnPath}'..."); Solution solution = ...