Roslyn provides a rich set of APIs for analyzing C# and Visual Basic source code, but constructing a context in which
to perform analysis can be challenging. For simple tasks, creating a
Compilation populated with
MetadataReferences and a handful of options may suffice. However, if there are multiple projects involved in the
analysis, it is more complicated because multiple
Compilations need to be created with references between them.
To simplify the construction process. Roslyn provides the
Workspace API, which can be used to model solutions,
projects and documents. The
Workspace API performs all of the heavy lifting needed to parse
SyntaxTrees from source
MetadataReferences, and construct
Compilations and add references between them.