Writing an application based on the Workspaces API to format and simplify all source files in the solution
In this section, we will write a C# console application based on Roslyn Workspaces APIs to load a C# solution into a workspace and then perform the following operations:
- Format the solution to change tabs to white spaces with a custom indentation size. This is a syntactic code refactoring.
- Simplify the solution to change local declarations to have an explicit type specification instead of var. This is a semantic code refactoring.
Note
You can read the XML documentation comments and implementation details for the Formatter and Simplifier for additional information on these operations at: http://source.roslyn.io/#Microsoft.CodeAnalysis.Workspaces/Formatting/Formatter.cs,f445ffe3c814c002 and http://source.roslyn.io/#Microsoft.CodeAnalysis.Workspaces/Simplification/Simplifier.cs,1d256ae3815b1cac, respectively.
Getting started
You will need to have the Visual Studio 2017 Community Edition installed...