ProjectAnalyzerExtensions.

AddToWorkspace(ProjectAnalyzer, Workspace, bool) Method

Summary

Adds a project to an existing Roslyn workspace. Note that this will rebuild the project. Use an AnalyzerResult instead if you already have one available.

Syntax

public static Project AddToWorkspace(this ProjectAnalyzer analyzer, Workspace workspace, bool addProjectReferences = false)

Parameters

Name Type Description
analyzer ProjectAnalyzer The Buildalyzer project analyzer.
workspace Workspace A Roslyn workspace.
addProjectReferences bool true to add projects to the workspace for project references that exist in the same AnalyzerManager. If true this will trigger (re)building all referenced projects. Directly add AnalyzerResult instances instead if you already have them available.

Return Value

Type Description
Project The newly added Roslyn project.