# New-ConfigurationFormat

Builds formatting options for code and manifest generation during the 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`

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

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

[#](#member-738c1917f11ce06aea4780c4)

Parameter set: `All Parameter Sets`

## Description

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

### Remove comments and normalize whitespace during merge

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

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

Applies formatting rules to the project sources as well as generated output.

## Parameters

**-AlignAssignmentStatementCheckHashtable SwitchParameter optional**

For PSAlignAssignmentStatement: align hashtable assignments.

**-AlignAssignmentStatementEnable SwitchParameter optional**

Enable PSAlignAssignmentStatement rule and optionally check hashtable alignment.

**-ApplyTo String[] required**

Targets to apply formatting to (OnMergePSM1, OnMergePSD1, DefaultPS1, DefaultPSM1, DefaultPSD1).

Possible values: `OnMergePSM1`, `OnMergePSD1`, `DefaultPS1`, `DefaultPSM1`, `DefaultPSD1`

**-EnableFormatting SwitchParameter optional**

Enables formatting for the chosen ApplyTo targets even if no specific rule switches are provided.

**-PlaceCloseBraceEnable SwitchParameter optional**

Enable PSPlaceCloseBrace rule and configure its behavior.

**-PlaceCloseBraceIgnoreOneLineBlock SwitchParameter optional**

For PSPlaceCloseBrace: ignore single-line blocks.

**-PlaceCloseBraceNewLineAfter SwitchParameter optional**

For PSPlaceCloseBrace: enforce a new line after the closing brace.

**-PlaceCloseBraceNoEmptyLineBefore SwitchParameter optional**

For PSPlaceCloseBrace: do not allow an empty line before a closing brace.

**-PlaceOpenBraceEnable SwitchParameter optional**

Enable PSPlaceOpenBrace rule and configure its behavior.

**-PlaceOpenBraceIgnoreOneLineBlock SwitchParameter optional**

For PSPlaceOpenBrace: ignore single-line blocks.

**-PlaceOpenBraceNewLineAfter SwitchParameter optional**

For PSPlaceOpenBrace: enforce a new line after the opening brace.

**-PlaceOpenBraceOnSameLine SwitchParameter optional**

For PSPlaceOpenBrace: place opening brace on the same line.

**-PSD1Style String optional**

Style for generated manifests (PSD1) for the selected ApplyTo targets.

Possible values: `Minimal`, `Native`

**-RemoveAllEmptyLines SwitchParameter optional**

Remove all empty lines (more aggressive than RemoveEmptyLines).

**-RemoveComments SwitchParameter optional**

Remove comments in the formatted output.

**-RemoveCommentsBeforeParamBlock SwitchParameter optional**

Remove comments that appear immediately before the param() block.

**-RemoveCommentsInParamBlock SwitchParameter optional**

Remove comments within the param() block.

**-RemoveEmptyLines SwitchParameter optional**

Remove empty lines while preserving readability.

**-Sort String optional**

Optional ordering hint for internal processing. Accepts None, Asc, or Desc.

Possible values: `Asc`, `Desc`

**-UpdateProjectRoot SwitchParameter optional**

When set, formats PowerShell sources in the project root in addition to staging output.

**-UseConsistentIndentationEnable SwitchParameter optional**

Enable PSUseConsistentIndentation rule and configure its behavior.

**-UseConsistentIndentationIndentationSize Int32 optional**

Number of spaces for indentation when Kind is space.

**-UseConsistentIndentationKind String optional**

Indentation style for PSUseConsistentIndentation: space or tab.

Possible values: `space`, `tab`

**-UseConsistentIndentationPipelineIndentation String optional**

Pipeline indentation mode for PSUseConsistentIndentation.

Possible values: `IncreaseIndentationAfterEveryPipeline`, `NoIndentation`

**-UseConsistentWhitespaceCheckInnerBrace SwitchParameter optional**

For PSUseConsistentWhitespace: check inner brace spacing.

**-UseConsistentWhitespaceCheckOpenBrace SwitchParameter optional**

For PSUseConsistentWhitespace: check open brace spacing.

**-UseConsistentWhitespaceCheckOpenParen SwitchParameter optional**

For PSUseConsistentWhitespace: check open parenthesis spacing.

**-UseConsistentWhitespaceCheckOperator SwitchParameter optional**

For PSUseConsistentWhitespace: check operator spacing.

**-UseConsistentWhitespaceCheckPipe SwitchParameter optional**

For PSUseConsistentWhitespace: check pipeline operator spacing.

**-UseConsistentWhitespaceCheckSeparator SwitchParameter optional**

For PSUseConsistentWhitespace: check separator (comma) spacing.

**-UseConsistentWhitespaceEnable SwitchParameter optional**

Enable PSUseConsistentWhitespace rule and configure which elements to check.

**-UseCorrectCasingEnable SwitchParameter optional**

Enable PSUseCorrectCasing rule.

## 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:77AB8A7193109D63DA82803A55E73857012ACD7BCCFFFD6FECEAFC4311A39759 -->
