Udostępnij za pośrednictwem


Project Class

Definition

Represents a project that is part of a Solution.

public ref class Project
[System.Diagnostics.DebuggerDisplay("{GetDebuggerDisplay(),nq}")]
public class Project
[<System.Diagnostics.DebuggerDisplay("{GetDebuggerDisplay(),nq}")>]
type Project = class
Public Class Project
Inheritance
Project
Attributes

Properties

AdditionalDocumentIds

All the additional document IDs associated with this project.

AdditionalDocuments

All the additional documents associated with this project.

AllProjectReferences

The list of all other projects that this project references, including projects that are not part of the solution.

AnalyzerConfigDocuments

All the AnalyzerConfigDocuments associated with this project.

AnalyzerOptions

The options used by analyzers for this project.

AnalyzerReferences

The list of all the diagnostic analyzer references for this project.

AssemblyName

The name of the assembly this project represents.

CompilationOptions

The options used when building the compilation for this project.

CompilationOutputInfo

Compilation output file paths.

DefaultNamespace

The default namespace of the project ("" if not defined, which means global namespace), or null if it is unknown or not applicable.

DocumentIds

All the document IDs associated with this project.

Documents

All the regular documents associated with this project. Documents produced from source generators are returned by GetSourceGeneratedDocumentsAsync(CancellationToken).

FilePath

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

HasDocuments

True if the project has any documents.

Id

The ID of the project. Multiple Project instances may share the same ID. However, only one project may have this ID in any given solution.

IsSubmission

Returns true if this is a submission project.

Language

The language associated with the project.

LanguageServices
Obsolete.

The language services from the host environment associated with this project's language.

MetadataReferences

The list of all other metadata sources (assemblies) that this project references.

Name

The name of the project. This may be different than the assembly name.

OutputFilePath

The path to the output file, or null if it is not known.

OutputRefFilePath

The path to the reference assembly output file, or null if it is not known.

ParseOptions

The options used when parsing documents for this project.

ProjectReferences

The list of all other projects within the same solution that this project references.

Services

Immutable snapshot of language services from the host environment associated with this project's language. Use this over LanguageServices when possible.

Solution

The solution this project is part of.

SupportsCompilation

true if this Project supports providing data through the GetCompilationAsync(CancellationToken) method.

If false then GetCompilationAsync(CancellationToken) method will return null instead.

Version

The project version. This equates to the version of the project file.

Methods

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

Creates a new additional document in a new instance of this project.

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

Creates a new additional document in a new instance of this project.

AddAnalyzerConfigDocument(String, SourceText, IEnumerable<String>, String)

Creates a new analyzer config document in a new instance of this project.

AddAnalyzerReference(AnalyzerReference)

Creates a new instance of this project updated to include the specified analyzer reference in addition to already existing ones.

AddAnalyzerReferences(IEnumerable<AnalyzerReference>)

Creates a new instance of this project updated to include the specified analyzer references in addition to already existing ones.

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

Creates a new document in a new instance of this project.

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

Creates a new document in a new instance of this project.

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

Creates a new document in a new instance of this project.

AddMetadataReference(MetadataReference)

Creates a new instance of this project updated to include the specified metadata reference in addition to already existing ones.

AddMetadataReferences(IEnumerable<MetadataReference>)

Creates a new instance of this project updated to include the specified metadata references in addition to already existing ones.

AddProjectReference(ProjectReference)

Creates a new instance of this project updated to include the specified project reference in addition to already existing ones.

AddProjectReferences(IEnumerable<ProjectReference>)

Creates a new instance of this project updated to include the specified project references in addition to already existing ones.

ContainsAdditionalDocument(DocumentId)

True if the project contains an additional document with the specified ID.

ContainsAnalyzerConfigDocument(DocumentId)

True if the project contains an AnalyzerConfigDocument with the specified ID.

ContainsDocument(DocumentId)

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

GetAdditionalDocument(DocumentId)

Get the additional document in this project with the specified document Id.

GetAnalyzerConfigDocument(DocumentId)

Get the analyzer config document in this project with the specified document Id.

GetChanges(Project)

Gets an object that lists the added, changed and removed documents between this project and the specified project.

GetCompilationAsync(CancellationToken)

Get the Compilation for this project asynchronously.

GetDependentSemanticVersionAsync(CancellationToken)

The semantic version of this project including the semantics of referenced projects. This version changes whenever the consumable declarations of this project and/or projects it depends on change.

GetDependentVersionAsync(CancellationToken)

The most recent version of the project, its documents and all dependent projects and documents.

GetDocument(DocumentId)

Get the document in this project with the specified document Id.

GetDocument(SyntaxTree)

Get the document in this project with the specified syntax tree.

GetDocumentId(SyntaxTree)

Get the documentId in this project with the specified syntax tree.

GetLatestDocumentVersionAsync(CancellationToken)

The version of the most recently modified document.

GetSemanticVersionAsync(CancellationToken)

The semantic version of this project not including the semantics of referenced projects. This version changes only when the consumable declarations of this project change.

GetSourceGeneratedDocumentAsync(DocumentId, CancellationToken)
GetSourceGeneratedDocumentsAsync(CancellationToken)

Gets all source generated documents in this project.

RemoveAdditionalDocument(DocumentId)

Creates a new instance of this project updated to no longer include the specified additional document.

RemoveAdditionalDocuments(ImmutableArray<DocumentId>)

Creates a new instance of this project updated to no longer include the specified additional documents.

RemoveAnalyzerConfigDocument(DocumentId)

Creates a new instance of this project updated to no longer include the specified analyzer config document.

RemoveAnalyzerConfigDocuments(ImmutableArray<DocumentId>)

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

RemoveAnalyzerReference(AnalyzerReference)

Creates a new instance of this project updated to no longer include the specified analyzer reference.

RemoveDocument(DocumentId)

Creates a new instance of this project updated to no longer include the specified document.

RemoveDocuments(ImmutableArray<DocumentId>)

Creates a new instance of this project updated to no longer include the specified documents.

RemoveMetadataReference(MetadataReference)

Creates a new instance of this project updated to no longer include the specified metadata reference.

RemoveProjectReference(ProjectReference)

Creates a new instance of this project updated to no longer include the specified project reference.

TryGetCompilation(Compilation)

Tries to get the cached Compilation for this project if it has already been created and is still cached. In almost all cases you should call GetCompilationAsync(CancellationToken) which will either return the cached Compilation or create a new one otherwise.

WithAnalyzerReferences(IEnumerable<AnalyzerReference>)

Creates a new instance of this project updated to replace existing analyzer references with the specified ones.

WithAssemblyName(String)

Creates a new instance of this project updated to have the new assembly name.

WithCompilationOptions(CompilationOptions)

Creates a new instance of this project updated to have the specified compilation options.

WithDefaultNamespace(String)

Creates a new instance of this project updated to have the new default namespace.

WithMetadataReferences(IEnumerable<MetadataReference>)

Creates a new instance of this project updated to replace existing metadata reference with the specified ones.

WithParseOptions(ParseOptions)

Creates a new instance of this project updated to have the specified parse options.

WithProjectReferences(IEnumerable<ProjectReference>)

Creates a new instance of this project updated to replace existing project references with the specified ones.

Applies to