# New-ConfigurationDotNetState

Creates preserve/restore state options for DotNet publish targets.

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`

**Outputs**

`PowerForge.DotNetPublishStatePreservationOptions`

Creates preserve/restore state options for DotNet publish targets.

## Syntax

```
New-ConfigurationDotNetState
[-ClearStorage <Boolean>]
[-Enabled]
[-OnMissingSource <Warn|Fail|Skip>]
[-OnRestoreFailure <Warn|Fail|Skip>]
[-Rules <DotNetPublishStateRule[]>]
[-StoragePath <String>]
[<CommonParameters>]
```

[#](#method-new-configurationdotnetstate-boolean-switchparameter-dotnetpublishpolicymode-dotnetpublishpolicymode-dotnetpublishstaterule-string)

Parameter set: `All Parameter Sets`

## Examples

### Create state preservation options

```powershell
$rule = New-ConfigurationDotNetStateRule -SourcePath 'config.json' -Overwrite
New-ConfigurationDotNetState -Enabled -Rules $rule -StoragePath 'Artifacts/DotNetPublish/State/{target}/{rid}/{framework}/{style}'
```

## Parameters

**-ClearStorage Boolean optional**

Clears storage before preserving state.

**-Enabled SwitchParameter optional**

Enables state preservation.

**-OnMissingSource DotNetPublishPolicyMode optional**

Policy for missing source paths.

Possible values: `Warn`, `Fail`, `Skip`

**-OnRestoreFailure DotNetPublishPolicyMode optional**

Policy for restore failures.

Possible values: `Warn`, `Fail`, `Skip`

**-Rules DotNetPublishStateRule[] optional**

State rules.

**-StoragePath String optional**

Optional storage path template.

## 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:EC46BE73A4DACE92C3E2F2776F87E24419D1445C68EC55FA3A66C98AD433E631 -->
