Evotec

Project

PSPublishModule

PSPublishModule is an open-source PowerShell and .NET project with packages, release history, and technical documentation.

Stars 43
Forks 13
Open issues 1
PowerShell Gallery downloads 13,876
Release v3.0.3
Language: C# Updated: 2026-04-14

API Reference

Cmdlet

New-ConfigurationFormat

Namespace PSPublishModule
Inputs
None
Outputs
System.Object

Builds formatting options for code and manifest generation during the build.

Remarks

Produces a formatting configuration segment used by the build pipeline to normalize generated output (merged PSM1/PSD1) and optionally apply formatting back to the project root.

Examples

Authored help example

Remove comments and normalize whitespace during merge

PS>


New-ConfigurationFormat -ApplyTo OnMergePSM1,OnMergePSD1 -RemoveComments -RemoveEmptyLines
        

Formats the merged module output and removes comments while keeping readability.

Also update files in the project root

PS>


New-ConfigurationFormat -ApplyTo DefaultPSM1,DefaultPSD1 -EnableFormatting -UpdateProjectRoot
        

Applies formatting rules to the project sources as well as generated 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.

Syntax

New-ConfigurationFormat [-AlignAssignmentStatementCheckHashtable] [-AlignAssignmentStatementEnable] -ApplyTo <OnMergePSM1|OnMergePSD1|DefaultPS1|DefaultPSM1|DefaultPSD1> [-EnableFormatting] [-PlaceCloseBraceEnable] [-PlaceCloseBraceIgnoreOneLineBlock] [-PlaceCloseBraceNewLineAfter] [-PlaceCloseBraceNoEmptyLineBefore] [-PlaceOpenBraceEnable] [-PlaceOpenBraceIgnoreOneLineBlock] [-PlaceOpenBraceNewLineAfter] [-PlaceOpenBraceOnSameLine] [-PSD1Style <Minimal|Native>] [-RemoveAllEmptyLines] [-RemoveComments] [-RemoveCommentsBeforeParamBlock] [-RemoveCommentsInParamBlock] [-RemoveEmptyLines] [-Sort <Asc|Desc>] [-UpdateProjectRoot] [-UseConsistentIndentationEnable] [-UseConsistentIndentationIndentationSize <Int32>] [-UseConsistentIndentationKind <space|tab>] [-UseConsistentIndentationPipelineIndentation <IncreaseIndentationAfterEveryPipeline|NoIndentation>] [-UseConsistentWhitespaceCheckInnerBrace] [-UseConsistentWhitespaceCheckOpenBrace] [-UseConsistentWhitespaceCheckOpenParen] [-UseConsistentWhitespaceCheckOperator] [-UseConsistentWhitespaceCheckPipe] [-UseConsistentWhitespaceCheckSeparator] [-UseConsistentWhitespaceEnable] [-UseCorrectCasingEnable] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Parameters

AlignAssignmentStatementCheckHashtable SwitchParameter optionalposition: namedpipeline: False
For PSAlignAssignmentStatement: align hashtable assignments.
AlignAssignmentStatementEnable SwitchParameter optionalposition: namedpipeline: False
Enable PSAlignAssignmentStatement rule and optionally check hashtable alignment.
ApplyTo String[] requiredposition: namedpipeline: Falsevalues: 5
Targets to apply formatting to (OnMergePSM1, OnMergePSD1, DefaultPS1, DefaultPSM1, DefaultPSD1).
Possible values: OnMergePSM1, OnMergePSD1, DefaultPS1, DefaultPSM1, DefaultPSD1
EnableFormatting SwitchParameter optionalposition: namedpipeline: False
Enables formatting for the chosen ApplyTo targets even if no specific rule switches are provided.
PlaceCloseBraceEnable SwitchParameter optionalposition: namedpipeline: False
Enable PSPlaceCloseBrace rule and configure its behavior.
PlaceCloseBraceIgnoreOneLineBlock SwitchParameter optionalposition: namedpipeline: False
For PSPlaceCloseBrace: ignore single-line blocks.
PlaceCloseBraceNewLineAfter SwitchParameter optionalposition: namedpipeline: False
For PSPlaceCloseBrace: enforce a new line after the closing brace.
PlaceCloseBraceNoEmptyLineBefore SwitchParameter optionalposition: namedpipeline: False
For PSPlaceCloseBrace: do not allow an empty line before a closing brace.
PlaceOpenBraceEnable SwitchParameter optionalposition: namedpipeline: False
Enable PSPlaceOpenBrace rule and configure its behavior.
PlaceOpenBraceIgnoreOneLineBlock SwitchParameter optionalposition: namedpipeline: False
For PSPlaceOpenBrace: ignore single-line blocks.
PlaceOpenBraceNewLineAfter SwitchParameter optionalposition: namedpipeline: False
For PSPlaceOpenBrace: enforce a new line after the opening brace.
PlaceOpenBraceOnSameLine SwitchParameter optionalposition: namedpipeline: False
For PSPlaceOpenBrace: place opening brace on the same line.
PSD1Style String optionalposition: namedpipeline: Falsevalues: 2
Style for generated manifests (PSD1) for the selected ApplyTo targets.
Possible values: Minimal, Native
RemoveAllEmptyLines SwitchParameter optionalposition: namedpipeline: False
Remove all empty lines (more aggressive than RemoveEmptyLines).
RemoveComments SwitchParameter optionalposition: namedpipeline: False
Remove comments in the formatted output.
RemoveCommentsBeforeParamBlock SwitchParameter optionalposition: namedpipeline: False
Remove comments that appear immediately before the param() block.
RemoveCommentsInParamBlock SwitchParameter optionalposition: namedpipeline: False
Remove comments within the param() block.
RemoveEmptyLines SwitchParameter optionalposition: namedpipeline: False
Remove empty lines while preserving readability.
Sort String optionalposition: namedpipeline: Falsevalues: 2
Optional ordering hint for internal processing. Accepts None, Asc, or Desc.
Possible values: Asc, Desc
UpdateProjectRoot SwitchParameter optionalposition: namedpipeline: False
When set, formats PowerShell sources in the project root in addition to staging output.
UseConsistentIndentationEnable SwitchParameter optionalposition: namedpipeline: False
Enable PSUseConsistentIndentation rule and configure its behavior.
UseConsistentIndentationIndentationSize Int32 optionalposition: namedpipeline: False
Number of spaces for indentation when Kind is space.
UseConsistentIndentationKind String optionalposition: namedpipeline: Falsevalues: 2
Indentation style for PSUseConsistentIndentation: space or tab.
Possible values: space, tab
UseConsistentIndentationPipelineIndentation String optionalposition: namedpipeline: Falsevalues: 2
Pipeline indentation mode for PSUseConsistentIndentation.
Possible values: IncreaseIndentationAfterEveryPipeline, NoIndentation
UseConsistentWhitespaceCheckInnerBrace SwitchParameter optionalposition: namedpipeline: False
For PSUseConsistentWhitespace: check inner brace spacing.
UseConsistentWhitespaceCheckOpenBrace SwitchParameter optionalposition: namedpipeline: False
For PSUseConsistentWhitespace: check open brace spacing.
UseConsistentWhitespaceCheckOpenParen SwitchParameter optionalposition: namedpipeline: False
For PSUseConsistentWhitespace: check open parenthesis spacing.
UseConsistentWhitespaceCheckOperator SwitchParameter optionalposition: namedpipeline: False
For PSUseConsistentWhitespace: check operator spacing.
UseConsistentWhitespaceCheckPipe SwitchParameter optionalposition: namedpipeline: False
For PSUseConsistentWhitespace: check pipeline operator spacing.
UseConsistentWhitespaceCheckSeparator SwitchParameter optionalposition: namedpipeline: False
For PSUseConsistentWhitespace: check separator (comma) spacing.
UseConsistentWhitespaceEnable SwitchParameter optionalposition: namedpipeline: False
Enable PSUseConsistentWhitespace rule and configure which elements to check.
UseCorrectCasingEnable SwitchParameter optionalposition: namedpipeline: False
Enable PSUseCorrectCasing rule.

Outputs

System.Object