Project

PSPublishModule

Build, test, version, sign, and publish PowerShell modules with reusable PowerForge pipelines.

Stars 48
Forks 16
PowerShell Gallery downloads 17,213
Release v3.0.169
Language: C# Updated: 2026-10-17
Command

New-ConfigurationFileConsistency

Module PSPublishModule
Inputs
None

Creates configuration for file consistency checking (encoding and line endings) during module build.

Syntax

New-ConfigurationFileConsistency [-AutoFix] [-CheckMissingFinalNewline] [-CheckMixedLineEndings] [-CreateBackups] [-Enable] [-EncodingOverrides <Hashtable>] [-ExcludeDirectories <String[]>] [-ExcludeFiles <String[]>] [-ExportReport] [-FailOnInconsistency] [-IncludePatterns <String[]>] [-LineEndingOverrides <Hashtable>] [-MaxInconsistencyPercentage <Int32>] [-ProjectKind <PowerShell|CSharp|Mixed|All>] [-ReportFileName <String>] [-RequiredEncoding <FileConsistencyEncoding>] [-RequiredLineEnding <CRLF|LF>] [-Scope <StagingOnly|ProjectOnly|StagingAndProject>] [-Severity <Off|Warning|Error>] [-UpdateProjectRoot] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Adds a file-consistency validation step to the pipeline. This can enforce required encoding/line-ending rules and (optionally) auto-fix issues during a build.

Examples

Authored help example

Enforce UTF-8 BOM + CRLF and auto-fix during build

New-ConfigurationFileConsistency -Enable -FailOnInconsistency -RequiredEncoding UTF8BOM -RequiredLineEnding CRLF -AutoFix -CreateBackups -ExportReport

Enforces consistency and exports a CSV report; backups are created before fixes are applied.

Audit project root consistency (no fixes)

New-ConfigurationFileConsistency -Enable -RequiredEncoding UTF8BOM -RequiredLineEnding CRLF -ExportReport -Scope StagingAndProject

Runs validation on staging and project root, exports a report, and does not apply automatic fixes.

Parameters

-AutoFix SwitchParameter optional
Automatically fix encoding and line ending issues during build.
-CheckMissingFinalNewline SwitchParameter optional
Check for files missing final newlines.
-CheckMixedLineEndings SwitchParameter optional
Check for files with mixed line endings.
-CreateBackups SwitchParameter optional
Create backup files before applying automatic fixes.
-Enable SwitchParameter optional
Enable file consistency checking during build.
-EncodingOverrides Hashtable optional
Per-path encoding overrides (patterns mapped to encodings).
-ExcludeDirectories String[] optional
Directory names to exclude from consistency analysis.
-ExcludeFiles String[] optional
File patterns to exclude from consistency analysis.
-ExportReport SwitchParameter optional
Export detailed consistency report to the artifacts directory.
-FailOnInconsistency SwitchParameter optional
Fail the build if consistency issues are found.
-IncludePatterns String[] optional
Custom include patterns (override default project kind patterns).
-LineEndingOverrides Hashtable optional
Per-path line ending overrides (patterns mapped to line endings).
-MaxInconsistencyPercentage Int32 optional
Maximum percentage of files that can have consistency issues. Default is 5.
-ProjectKind ProjectKind optional
Project kind used to derive default include patterns.
Possible values: PowerShell, CSharp, Mixed, All
-ReportFileName String optional
Custom filename for the consistency report.
-RequiredEncoding FileConsistencyEncoding optional
Required file encoding.
Possible values: ASCII, UTF8, UTF8BOM, Unicode, BigEndianUnicode, UTF7, UTF32
-RequiredLineEnding FileConsistencyLineEnding optional
Required line ending style.
Possible values: CRLF, LF
-Scope FileConsistencyScope optional
Scope for file consistency checks (staging/project).
Possible values: StagingOnly, ProjectOnly, StagingAndProject
-Severity ValidationSeverity optional
Severity for consistency issues (overrides FailOnInconsistency when specified).
Possible values: Off, Warning, Error
-UpdateProjectRoot SwitchParameter optional
Legacy switch. When set, applies encoding/line-ending consistency fixes to the project root as well as staging output.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.