ReadProject Wyam.CodeAnalysis

Reads all the source files from a specified msbuild project. This module will be executed once and input documents will be ignored if a search path is specified. Otherwise, if a delegate is specified the module will be executed once per input document and the resulting output documents will be aggregated. Note that this requires the MSBuild tools to be installed (included with Visual Studio).
The output of this module is similar to executing the ReadFiles module on all source files in the project.

Package

This module exists in the Wyam.CodeAnalysis package which is not part of the core distribution. Add the following preprocessor directive to your configuration file to use it:
#n Wyam.CodeAnalysis

Usage

  • ReadProject(DocumentConfig path)

    Reads the project file at the specified path. This allows you to specify a different project file depending on the input.

    • path

      A delegate that returns a FilePath with the project file path.

  • ReadProject(FilePath path)

    Reads the project file at the specified path.

    • path

      The project file path.

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • WhereFile(Func<IFile, bool> predicate)

    Filters the source code file based on path.

    • predicate

      A predicate that should return true if the source code file should be included.

  • WhereProject(Func<string, bool> predicate)

    Filters the project based on name.

    • predicate

      A predicate that should return true if the project should be included.

  • WithExtensions(params string[] extensions)

    Filters the source code files based on extension.

    • extensions

      The extensions to include (if defined, any extensions not listed will be excluded).

Settings

The settings listed below apply globally and can be set from the command line or from a configuration file. They are used to configure options and otherwise control module behavior.

  • CodeAnalysisKeys.OutputBuildLog: System.Boolean

    Set this to true in the global settings to generate a binary build log when analyzing projects or solutions. The log will be output alongside the project file.

Output Metadata

The metadata values listed below apply to individual documents and are created and set by the module as indicated in their descriptions.

  • CodeAnalysisKeys.AssemblyName: System.String

    The name of the assembly for each input document. Used to group input documents by assembly (if provided). If this is not provided for each input source document, then analysis that depends on both source files and assemblies may not correctly bind symbols across multiple inputs.

  • Keys.RelativeFileDir: Wyam.Common.IO.DirectoryPath

    The path to the folder containing the file relative to the input folder.

  • Keys.RelativeFilePath: Wyam.Common.IO.FilePath

    The path to the file relative to the input folder. This metadata value is used when generating links to the document.

  • Keys.RelativeFilePathBase: Wyam.Common.IO.FilePath

    The path to the file relative to the input folder without extension.

  • Keys.SourceFileBase: Wyam.Common.IO.FilePath

    The name of the original file without extension.

  • Keys.SourceFileDir: Wyam.Common.IO.DirectoryPath

    The absolute path to the folder of the original file.

  • Keys.SourceFileExt: System.String

    The extension of the original file (including the ".").

  • Keys.SourceFileName: Wyam.Common.IO.FilePath

    The file name of the original file with extension.

  • Keys.SourceFilePath: Wyam.Common.IO.FilePath

    The absolute path to the original file.

  • Keys.SourceFilePathBase: Wyam.Common.IO.FilePath

    The absolute path to the original file without the file extension.

  • Keys.SourceFileRoot: Wyam.Common.IO.DirectoryPath

    The absolute root search path without any nested directories (I.e., the path that was searched, and possibly descended, for the given pattern).

GitHub