| external help file | PSPublishModule-help.xml |
|---|---|
| Module Name | PSPublishModule |
| online version | https://github.com/EvotecIT/PSPublishModule |
| schema | 2.0.0 |
Converts a project to a consistent encoding/line ending policy and reports the results.
Convert-ProjectConsistency -Path <string> [-ProjectType <string>] [-CustomExtensions <string[]>] [-ExcludeDirectories <string[]>] [-ExcludeFiles <string[]>] [-RequiredEncoding <FileConsistencyEncoding>] [-RequiredLineEnding <FileConsistencyLineEnding>] [-SourceEncoding <TextEncodingKind>] [-FixEncoding] [-FixLineEndings] [-EncodingOverrides <IDictionary>] [-LineEndingOverrides <IDictionary>] [-CreateBackups] [-BackupDirectory <string>] [-Force] [-NoRollbackOnMismatch] [-OnlyMixedLineEndings] [-EnsureFinalNewline] [-OnlyMissingFinalNewline] [-ShowDetails] [-ExportPath <string>] [-WhatIf] [-Confirm] [<CommonParameters>]This cmdlet applies a consistency policy (encoding and/or line endings) across a project tree. It can also export a post-conversion report so you can validate what remains inconsistent.
For build-time enforcement, use New-ConfigurationFileConsistency -AutoFix in the module build pipeline.
PS> Convert-ProjectConsistency -Path 'C:\MyProject' -ProjectType PowerShell -CreateBackupsEnsures PowerShell-friendly encoding and line endings, creating backups before changes.
PS> Convert-ProjectConsistency -Path 'C:\MyProject' -FixLineEndings -RequiredLineEnding LF -ExcludeDirectories 'Build','Docs'Normalizes line endings to LF and skips non-source folders.
PS> Convert-ProjectConsistency -Path 'C:\MyProject' -FixEncoding -RequiredEncoding UTF8BOM -EncodingOverrides @{ '*.xml' = 'UTF8' } -ExportPath 'C:\Reports\consistency.csv'Uses UTF-8 BOM by default but keeps XML files UTF-8 without BOM, and writes a report.
Backup root folder (mirrors the project structure).
Type: String
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueCreate backup files before modifying content.
Type: SwitchParameter
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueCustom file extensions to include when ProjectType is Custom (e.g., *.ps1, *.cs).
Type: String[]
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TruePer-path encoding overrides (hashtable of pattern => encoding).
Type: IDictionary
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueEnsure a final newline exists after line ending conversion.
Type: SwitchParameter
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueDirectory names to exclude from conversion (e.g., .git, bin, obj).
Type: String[]
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueFile patterns to exclude from conversion.
Type: String[]
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueExport the detailed report to a CSV file at the specified path.
Type: String
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueConvert encoding inconsistencies.
Type: SwitchParameter
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueConvert line ending inconsistencies.
Type: SwitchParameter
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueForce conversion even when the file already matches the target.
Type: SwitchParameter
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TruePer-path line ending overrides (hashtable of pattern => line ending).
Type: IDictionary
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueDo not rollback from backup if verification mismatch occurs during encoding conversion.
Type: SwitchParameter
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueOnly fix files missing the final newline.
Type: SwitchParameter
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueOnly convert files that have mixed line endings.
Type: SwitchParameter
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TruePath to the project directory to convert.
Type: String
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: True
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueType of project to analyze. Determines which file extensions are included.
Type: String
Parameter Sets: __AllParameterSets
Aliases: None
Possible values: PowerShell, CSharp, Mixed, All, Custom
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueTarget encoding to enforce when fixing encoding consistency.
Type: FileConsistencyEncoding
Parameter Sets: __AllParameterSets
Aliases: None
Possible values: ASCII, UTF8, UTF8BOM, Unicode, BigEndianUnicode, UTF7, UTF32
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueTarget line ending style to enforce when fixing line endings.
Type: FileConsistencyLineEnding
Parameter Sets: __AllParameterSets
Aliases: None
Possible values: CRLF, LF
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueInclude detailed file-by-file analysis in the output.
Type: SwitchParameter
Parameter Sets: __AllParameterSets
Aliases: None
Possible values:
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueSource encoding filter. When Any, any non-target encoding may be converted.
Type: TextEncodingKind
Parameter Sets: __AllParameterSets
Aliases: None
Possible values: Ascii, BigEndianUnicode, Unicode, UTF7, UTF8, UTF8BOM, UTF32, Default, OEM, Any
Required: False
Position: named
Default value: None
Accept pipeline input: False
Accept wildcard characters: TrueThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
None
System.Object
- None