# New-ConfigurationFileConsistency

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

Project

PSPublishModule

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

[View on GitHub](https://github.com/EvotecIT/PSPublishModule) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSPublishModule/releases/tag/v3.0.124) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSPublishModule/2.0.27)

Stars **48**

Forks **15**

Open issues **1**

PowerShell Gallery downloads **17,213**

Release **v3.0.195**

Language: C# Updated: 2026-11-25

Command 

**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>]
```

[#](#member-bc59f2860376e0ffbef5eba3)

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

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

```powershell
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)

```powershell
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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:41A8F16369519D7FD803F186A2E158D66F8B615CC5DBD12FBA306C64688031D1 -->
