Delen via


Solution Class

Definition

Represents a set of projects and their source code documents.

public ref class Solution
public class Solution
type Solution = class
Public Class Solution
Inheritance
Solution

Properties

AnalyzerReferences

Analyzer references associated with the solution.

FilePath

The path to the solution file or null if there is no solution file.

Id

The Id of the solution. Multiple solution instances may share the same Id.

Options

Returns the options that should be applied to this solution. This is equivalent to Options when the Solution instance was created.

ProjectIds

A list of all the ids for all the projects contained by the solution.

Projects

A list of all the projects contained by the solution.

Services

Per solution services provided by the host environment. Use this instead of Services when possible.

Version

The solution version. This equates to the solution file's version.

Workspace

The Workspace this solution is associated with.

Methods

AddAdditionalDocument(DocumentId, String, SourceText, IEnumerable<String>, String)

Creates a new solution instance with the corresponding project updated to include a new additional document instance defined by its name and text.

AddAdditionalDocument(DocumentId, String, String, IEnumerable<String>, String)

Creates a new solution instance with the corresponding project updated to include a new additional document instance defined by its name and text.

AddAdditionalDocument(DocumentInfo)
AddAdditionalDocuments(ImmutableArray<DocumentInfo>)
AddAnalyzerConfigDocument(DocumentId, String, SourceText, IEnumerable<String>, String)

Creates a new solution instance with the corresponding project updated to include a new analyzer config document instance defined by its name and text.

AddAnalyzerConfigDocuments(ImmutableArray<DocumentInfo>)

Creates a new Solution instance that contains a new compiler configuration document like a .editorconfig file.

AddAnalyzerReference(AnalyzerReference)

Create a new solution instance updated to include the specified analyzer reference.

AddAnalyzerReference(ProjectId, AnalyzerReference)

Create a new solution instance with the project specified updated to include the specified analyzer reference.

AddAnalyzerReferences(IEnumerable<AnalyzerReference>)

Create a new solution instance updated to include the specified analyzer references.

AddAnalyzerReferences(ProjectId, IEnumerable<AnalyzerReference>)

Create a new solution instance with the project specified updated to include the specified analyzer references.

AddDocument(DocumentId, String, SourceText, IEnumerable<String>, String, Boolean)

Creates a new solution instance with the corresponding project updated to include a new document instance defined by its name and text.

AddDocument(DocumentId, String, String, IEnumerable<String>, String)

Creates a new solution instance with the corresponding project updated to include a new document instance defined by its name and text.

AddDocument(DocumentId, String, SyntaxNode, IEnumerable<String>, String, Boolean, PreservationMode)

Creates a new solution instance with the corresponding project updated to include a new document instance defined by its name and root SyntaxNode.

AddDocument(DocumentId, String, TextLoader, IEnumerable<String>)

Creates a new solution instance with the project updated to include a new document with the arguments specified.

AddDocument(DocumentInfo)

Create a new solution instance with the corresponding project updated to include a new document instanced defined by the document info.

AddDocuments(ImmutableArray<DocumentInfo>)

Create a new Solution instance with the corresponding Projects updated to include the documents specified by documentInfos.

AddMetadataReference(ProjectId, MetadataReference)

Create a new solution instance with the project specified updated to include the specified metadata reference.

AddMetadataReferences(ProjectId, IEnumerable<MetadataReference>)

Create a new solution instance with the project specified updated to include the specified metadata references.

AddProject(ProjectId, String, String, String)

Creates a new solution instance that includes a project with the specified language and names.

AddProject(ProjectInfo)

Create a new solution instance that includes a project with the specified project information.

AddProject(String, String, String)

Creates a new solution instance that includes a project with the specified language and names. Returns the new project.

AddProjectReference(ProjectId, ProjectReference)

Create a new solution instance with the project specified updated to include the specified project reference.

AddProjectReferences(ProjectId, IEnumerable<ProjectReference>)

Create a new solution instance with the project specified updated to include the specified project references.

ContainsAdditionalDocument(DocumentId)

True if the solution contains the additional document in one of its projects

ContainsAnalyzerConfigDocument(DocumentId)

True if the solution contains the analyzer config document in one of its projects

ContainsDocument(DocumentId)

True if the solution contains the document in one of its projects

ContainsProject(ProjectId)

True if the solution contains a project with the specified project ID.

GetAdditionalDocument(DocumentId)

Gets the additional document in this solution with the specified document ID.

GetAnalyzerConfigDocument(DocumentId)

Gets the analyzer config document in this solution with the specified document ID.

GetChanges(Solution)

Gets an objects that lists the added, changed and removed projects between this solution and the specified solution.

GetDocument(DocumentId)

Gets the document in this solution with the specified document ID.

GetDocument(SyntaxTree)

Gets the document in this solution with the specified syntax tree.

GetDocumentId(SyntaxTree, ProjectId)

Gets the documentId in this solution with the specified syntax tree.

GetDocumentId(SyntaxTree)

Gets the documentId in this solution with the specified syntax tree.

GetDocumentIdsWithFilePath(String)

Gets the set of DocumentIds in this Solution with a FilePath that matches the given file path.

GetIsolatedSolution()
Obsolete.

Formerly, returned a copy of the solution isolated from the original so that they do not share computed state. It now does nothing.

GetLatestProjectVersion()

The version of the most recently modified project.

GetProject(IAssemblySymbol, CancellationToken)

Gets the Project associated with an assembly symbol.

GetProject(ProjectId)

Gets the project in this solution with the specified project ID.

If the id is not an id of a project that is part of this solution the method returns null.

GetProjectDependencyGraph()

Gets a ProjectDependencyGraph that details the dependencies between projects for this solution.

GetSourceGeneratedDocumentAsync(DocumentId, CancellationToken)
RemoveAdditionalDocument(DocumentId)

Creates a new solution instance that no longer includes the specified additional document.

RemoveAdditionalDocuments(ImmutableArray<DocumentId>)

Creates a new solution instance that no longer includes the specified additional documents.

RemoveAnalyzerConfigDocument(DocumentId)

Creates a new solution instance that no longer includes the specified AnalyzerConfigDocument.

RemoveAnalyzerConfigDocuments(ImmutableArray<DocumentId>)

Creates a new solution instance that no longer includes the specified AnalyzerConfigDocuments.

RemoveAnalyzerReference(AnalyzerReference)

Create a new solution instance with the project specified updated to no longer include the specified analyzer reference.

RemoveAnalyzerReference(ProjectId, AnalyzerReference)

Create a new solution instance with the project specified updated to no longer include the specified analyzer reference.

RemoveDocument(DocumentId)

Creates a new solution instance that no longer includes the specified document.

RemoveDocuments(ImmutableArray<DocumentId>)

Creates a new solution instance that no longer includes the specified documents.

RemoveMetadataReference(ProjectId, MetadataReference)

Create a new solution instance with the project specified updated to no longer include the specified metadata reference.

RemoveProject(ProjectId)

Create a new solution instance without the project specified.

RemoveProjectReference(ProjectId, ProjectReference)

Create a new solution instance with the project specified updated to no longer include the specified project reference.

WithAdditionalDocumentText(DocumentId, SourceText, PreservationMode)

Creates a new solution instance with the additional document specified updated to have the text specified.

WithAdditionalDocumentText(DocumentId, TextAndVersion, PreservationMode)

Creates a new solution instance with the additional document specified updated to have the text and version specified.

WithAdditionalDocumentTextLoader(DocumentId, TextLoader, PreservationMode)

Creates a new solution instance with the additional document specified updated to have the text supplied by the text loader.

WithAnalyzerConfigDocumentText(DocumentId, SourceText, PreservationMode)

Creates a new solution instance with the analyzer config document specified updated to have the text supplied by the text loader.

WithAnalyzerConfigDocumentText(DocumentId, TextAndVersion, PreservationMode)

Creates a new solution instance with the analyzer config document specified updated to have the text and version specified.

WithAnalyzerConfigDocumentTextLoader(DocumentId, TextLoader, PreservationMode)

Creates a new solution instance with the analyzer config document specified updated to have the text supplied by the text loader.

WithAnalyzerReferences(IEnumerable<AnalyzerReference>)

Creates a new solution instance with the specified analyzer references.

WithDocumentFilePath(DocumentId, String)

Creates a new solution instance with the document specified updated to have the specified file path.

WithDocumentFolders(DocumentId, IEnumerable<String>)

Creates a new solution instance with the document specified updated to be contained in the sequence of logical folders.

WithDocumentName(DocumentId, String)

Creates a new solution instance with the document specified updated to have the new name.

WithDocumentSourceCodeKind(DocumentId, SourceCodeKind)

Creates a new solution instance with the document specified updated to have the source code kind specified.

WithDocumentSyntaxRoot(DocumentId, SyntaxNode, PreservationMode)

Creates a new solution instance with the document specified updated to have a syntax tree rooted by the specified syntax node.

WithDocumentText(DocumentId, SourceText, PreservationMode)

Creates a new solution instance with the document specified updated to have the text specified.

WithDocumentText(DocumentId, TextAndVersion, PreservationMode)

Creates a new solution instance with the document specified updated to have the text and version specified.

WithDocumentText(IEnumerable<DocumentId>, SourceText, PreservationMode)

Creates a new solution instance with all the documents specified updated to have the same specified text.

WithDocumentTextLoader(DocumentId, TextLoader, PreservationMode)

Creates a new solution instance with the document specified updated to have the text supplied by the text loader.

WithOptions(OptionSet)

Creates a new solution instance with the specified options.

WithProjectAnalyzerReferences(ProjectId, IEnumerable<AnalyzerReference>)

Create a new solution instance with the project specified updated to include only the specified analyzer references.

WithProjectAssemblyName(ProjectId, String)

Creates a new solution instance with the project specified updated to have the new assembly name.

WithProjectCompilationOptions(ProjectId, CompilationOptions)

Create a new solution instance with the project specified updated to have the specified compilation options.

WithProjectCompilationOutputInfo(ProjectId, CompilationOutputInfo)

Creates a new solution instance with the project specified updated to have the compiler output file path.

WithProjectDefaultNamespace(ProjectId, String)

Creates a new solution instance with the project specified updated to have the default namespace.

WithProjectDocumentsOrder(ProjectId, ImmutableList<DocumentId>)

Creates a new solution instance with the project documents in the order by the specified document ids. The specified document ids must be the same as what is already in the project; no adding or removing is allowed.

WithProjectFilePath(ProjectId, String)

Creates a new solution instance with the project specified updated to have the project file path.

WithProjectMetadataReferences(ProjectId, IEnumerable<MetadataReference>)

Create a new solution instance with the project specified updated to include only the specified metadata references.

WithProjectName(ProjectId, String)

Creates a new solution instance with the project specified updated to have the name.

WithProjectOutputFilePath(ProjectId, String)

Creates a new solution instance with the project specified updated to have the output file path.

WithProjectOutputRefFilePath(ProjectId, String)

Creates a new solution instance with the project specified updated to have the reference assembly output file path.

WithProjectParseOptions(ProjectId, ParseOptions)

Create a new solution instance with the project specified updated to have the specified parse options.

WithProjectReferences(ProjectId, IEnumerable<ProjectReference>)

Create a new solution instance with the project specified updated to contain the specified list of project references.

Applies to