API Reference
Get-ProjectConsistency
Provides comprehensive analysis of encoding and line ending consistency across a project.
Remarks
This cmdlet combines encoding and line-ending analysis to provide a single “consistency” view of your repository. It is intended to be run before bulk conversions (encoding/line endings) and before packaging a module for release. For fixing issues during builds, use New-ConfigurationFileConsistency with -AutoFix enabled.
Examples
Analyze a PowerShell project with defaults
PS>
Get-ProjectConsistency -Path 'C:\MyProject' -ProjectType PowerShell
Reports encoding and line ending consistency using PowerShell-friendly defaults.
Analyze with explicit recommendations and detailed output
PS>
Get-ProjectConsistency -Path 'C:\MyProject' -ProjectType Mixed -RecommendedEncoding UTF8BOM -RecommendedLineEnding LF -ShowDetails
Useful when you want to enforce a policy (e.g. UTF-8 BOM for PS 5.1 compatibility and LF for cross-platform repos).
Export a detailed report to CSV
PS>
Get-ProjectConsistency -Path 'C:\MyProject' -ProjectType CSharp -RecommendedEncoding UTF8 -ExportPath 'C:\Reports\consistency-report.csv'
Exports the per-file details so you can review issues outside the console.
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
Get-ProjectConsistency [-CustomExtensions <String[]>] [-ExcludeDirectories <String[]>] [-ExportPath <String>] -Path <String> [-ProjectType <PowerShell|CSharp|Mixed|All|Custom>] [-RecommendedEncoding <Nullable`1>] [-RecommendedLineEnding <Nullable`1>] [-ShowDetails] [<CommonParameters>]
#
All Parameter SetsParameters
- CustomExtensions String[]
- Custom file extensions to analyze when ProjectType is Custom (e.g., *.ps1, *.cs).
- ExcludeDirectories String[]
- Directory names to exclude from analysis (e.g., .git, bin, obj).
- ExportPath String
- Export the detailed report to a CSV file at the specified path.
- Path String
- Path to the project directory to analyze.
- ProjectType String
- Type of project to analyze. Determines which file extensions are included.
- Possible values:
PowerShell,CSharp,Mixed,All,Custom - RecommendedEncoding Nullable`1
- The encoding standard you want to achieve (optional).
- RecommendedLineEnding Nullable`1
- The line ending standard you want to achieve (optional).
- ShowDetails SwitchParameter
- Include detailed file-by-file analysis in the output.
Outputs
System.Object