API Reference
New-ConfigurationFileConsistency
Creates configuration for file consistency checking (encoding and line endings) during module build.
Remarks
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
Enforce UTF-8 BOM + CRLF and auto-fix during build
PS>
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)
PS>
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.
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.
Syntax
New-ConfigurationFileConsistency [-AutoFix] [-CheckMissingFinalNewline] [-CheckMixedLineEndings] [-CreateBackups] [-Enable] [-EncodingOverrides <Hashtable>] [-ExcludeDirectories <String[]>] [-ExcludeFiles <String[]>] [-ExportReport] [-FailOnInconsistency] [-IncludePatterns <String[]>] [-LineEndingOverrides <Hashtable>] [-MaxInconsistencyPercentage <Int32>] [-ProjectKind <Nullable`1>] [-ReportFileName <String>] [-RequiredEncoding <ASCII>] [-RequiredLineEnding <CRLF|LF>] [-Scope <StagingOnly|ProjectOnly|StagingAndProject>] [-Severity <Nullable`1>] [-UpdateProjectRoot] [<CommonParameters>]
#
All Parameter SetsParameters
- AutoFix SwitchParameter
- Automatically fix encoding and line ending issues during build.
- CheckMissingFinalNewline SwitchParameter
- Check for files missing final newlines.
- CheckMixedLineEndings SwitchParameter
- Check for files with mixed line endings.
- CreateBackups SwitchParameter
- Create backup files before applying automatic fixes.
- Enable SwitchParameter
- Enable file consistency checking during build.
- EncodingOverrides Hashtable
- Per-path encoding overrides (patterns mapped to encodings).
- ExcludeDirectories String[]
- Directory names to exclude from consistency analysis.
- ExcludeFiles String[]
- File patterns to exclude from consistency analysis.
- ExportReport SwitchParameter
- Export detailed consistency report to the artifacts directory.
- FailOnInconsistency SwitchParameter
- Fail the build if consistency issues are found.
- IncludePatterns String[]
- Custom include patterns (override default project kind patterns).
- LineEndingOverrides Hashtable
- Per-path line ending overrides (patterns mapped to line endings).
- MaxInconsistencyPercentage Int32
- Maximum percentage of files that can have consistency issues. Default is 5.
- ProjectKind Nullable`1
- Project kind used to derive default include patterns.
- ReportFileName String
- Custom filename for the consistency report.
- RequiredEncoding FileConsistencyEncoding
- Required file encoding.
- Possible values:
ASCII,UTF8,UTF8BOM,Unicode,BigEndianUnicode,UTF7,UTF32 - RequiredLineEnding FileConsistencyLineEnding
- Required line ending style.
- Possible values:
CRLF,LF - Scope FileConsistencyScope
- Scope for file consistency checks (staging/project).
- Possible values:
StagingOnly,ProjectOnly,StagingAndProject - Severity Nullable`1
- Severity for consistency issues (overrides FailOnInconsistency when specified).
- UpdateProjectRoot SwitchParameter
- Legacy switch. When set, applies encoding/line-ending consistency fixes to the project root as well as staging output.
Outputs
System.Object