Definition

Assembly: CloudNimble.DotNetDocs.Core.dll Namespace: CloudNimble.DotNetDocs.Core Inheritance: System.Object

Syntax

CloudNimble.DotNetDocs.Core.ProjectContext

Summary

Represents MSBuild project context for source intent in documentation generation.

Remarks

Provides metadata such as referenced assembly paths and the conceptual documentation folder path. Used by ProjectContext) to enhance metadata extraction. <example>
// Default (public members only)
var context = new ProjectContext("ref1.dll", "ref2.dll") { ConceptualPath = "conceptual" };

// Include public and internal members
var context = new ProjectContext([Accessibility.Public, Accessibility.Internal], "ref1.dll", "ref2.dll");

var model = await manager.DocumentAsync("MyLib.dll", "MyLib.xml", context);
</example>

Examples

// Default (public members only)
var context = new ProjectContext("ref1.dll", "ref2.dll") { ConceptualPath = "conceptual" };

// Include public and internal members
var context = new ProjectContext([Accessibility.Public, Accessibility.Internal], "ref1.dll", "ref2.dll");

var model = await manager.DocumentAsync("MyLib.dll", "MyLib.xml", context);

Constructors

.ctor

Initializes a new instance of ProjectContext with default settings.

Syntax

public ProjectContext()

.ctor

Initializes a new instance of ProjectContext with optional included members and referenced assemblies.

Syntax

public ProjectContext(System.Collections.Generic.List<Microsoft.CodeAnalysis.Accessibility> includedMembers, params string[] references)

Parameters

NameTypeDescription
includedMembersSystem.Collections.Generic.List<Microsoft.CodeAnalysis.Accessibility?>?List of member accessibilities to include. Defaults to Public if null.
referencesstring[]?Paths to referenced assemblies.

Properties

ApiReferencePath

Gets or sets the path to the API reference documentation.

Syntax

public string ApiReferencePath { get; set; }

Property Value

Type: string

ConceptualPath

Gets or sets the path to the conceptual documentation folder.

Syntax

public string ConceptualPath { get; set; }

Property Value

Type: string The file system path to the folder containing conceptual documentation files.

DocumentationRootPath

Gets or sets the output path for generated documentation.

Syntax

public string DocumentationRootPath { get; set; }

Property Value

Type: string The file system path where documentation output will be generated.

ExcludedTypes

Gets or sets the list of type patterns to exclude from documentation.

Syntax

public System.Collections.Generic.HashSet<string> ExcludedTypes { get; set; }

Property Value

Type: System.Collections.Generic.HashSet<string> Set of type patterns to exclude. Supports wildcards (*) for flexible matching. This is useful for filtering out compiler-generated or test framework-injected types.

Examples

ExcludedTypes = new HashSet<string>

Remarks

Patterns can use wildcards:
  • ”*.TypeName” matches TypeName in any namespace
  • “Namespace.*.TypeName” matches TypeName in any sub-namespace of Namespace
  • “Full.Namespace.TypeName” matches exact fully qualified type name

FileNamingOptions

Gets or sets the file naming options for documentation generation.

Syntax

public CloudNimble.DotNetDocs.Core.Configuration.FileNamingOptions FileNamingOptions { get; set; }

Property Value

Type: CloudNimble.DotNetDocs.Core.Configuration.FileNamingOptions Configuration for how documentation files are named and organized.

IncludedMembers

Gets or sets the list of member accessibilities to include in documentation.

Syntax

public System.Collections.Generic.List<Microsoft.CodeAnalysis.Accessibility> IncludedMembers { get; set; }

Property Value

Type: System.Collections.Generic.List<Microsoft.CodeAnalysis.Accessibility> List of accessibility levels to include. Defaults to Public only.

IncludeFields

Gets or sets whether to include fields in the documentation.

Syntax

public bool IncludeFields { get; set; }

Property Value

Type: bool When true, public fields (including constants) are included in the documentation. Defaults to false since fields are generally discouraged in favor of properties.

References

Gets or sets the collection of paths to referenced assemblies.

Syntax

public System.Collections.Generic.List<string> References { get; set; }

Property Value

Type: System.Collections.Generic.List<string> A collection of file system paths to assemblies referenced by the project being documented.

ShowPlaceholders

Gets or sets whether to show placeholder content in the documentation.

Syntax

public bool ShowPlaceholders { get; set; }

Property Value

Type: bool When true (default), placeholder content is included. When false, files containing the TODO marker comment are skipped during loading.

Methods

EnsureOutputDirectoryStructure

Ensures that the output directory structure exists for all namespaces in the assembly model.

Syntax

public void EnsureOutputDirectoryStructure(CloudNimble.DotNetDocs.Core.DocAssembly assemblyModel, string outputPath)

Parameters

NameTypeDescription
assemblyModelCloudNimble.DotNetDocs.Core.DocAssemblyThe assembly model containing namespaces to create directories for.
outputPathstringThe base output path where directories will be created.

Remarks

This method creates the necessary folder structure when using Folder mode. In File mode, it simply ensures the base output directory exists. This centralizes folder creation logic so renderers can assume directories exist.

GetNamespaceFolderPath

Converts a namespace string to a folder path based on the configured file naming options.

Syntax

public string GetNamespaceFolderPath(string namespaceName)

Parameters

NameTypeDescription
namespaceNamestringThe namespace name to convert (e.g., “System.Collections.Generic”).

Returns

Type: string The folder path representation of the namespace.

Remarks

When FileNamingOptions.NamespaceMode is NamespaceMode.Folder, this returns a path with folders for each namespace part (e.g., “System/Collections/Generic”). When using NamespaceMode.File, this returns an empty string as no folder structure is created.

GetSafeNamespaceName

Gets the safe namespace name for a given namespace symbol.

Syntax

public string GetSafeNamespaceName(Microsoft.CodeAnalysis.INamespaceSymbol namespaceSymbol)

Parameters

NameTypeDescription
namespaceSymbolMicrosoft.CodeAnalysis.INamespaceSymbolThe namespace symbol.

Returns

Type: string A safe namespace name, using “global” for the global namespace.

GetTypeFilePath

Gets the full file path for a type, including namespace folder structure if in Folder mode.

Syntax

public string GetTypeFilePath(string fullyQualifiedTypeName, string extension)

Parameters

NameTypeDescription
fullyQualifiedTypeNamestringThe fully qualified type name (e.g., “System.Text.Json.JsonSerializer”).
extensionstringThe file extension without the dot (e.g., “md”, “yaml”).

Returns

Type: string The file path for the type.

Remarks

In Folder mode: “System.Text.Json.JsonSerializer” becomes “System/Text/Json/JsonSerializer.md” In File mode: “System.Text.Json.JsonSerializer” becomes “System_Text_Json_JsonSerializer.md” (using configured separator)

IsTypeExcluded

Checks if a type should be excluded from documentation based on exclusion patterns.

Syntax

public bool IsTypeExcluded(string fullyQualifiedTypeName)

Parameters

NameTypeDescription
fullyQualifiedTypeNamestringThe fully qualified type name to check.

Returns

Type: bool True if the type should be excluded; otherwise, false.