# Invoke-DotNetPublish

Executes DotNet publish engine from DSL settings or an existing JSON config.

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.DotNetPublishPlan` `PowerForge.DotNetPublishResult`

Executes DotNet publish engine from DSL settings or an existing JSON config.

## Syntax

```
Invoke-DotNetPublish
[-ExitCode]
[-Frameworks <String[]>]
[-JsonOnly]
[-JsonPath <String>]
[-MsBuildProperty <Hashtable>]
[-NoInteractive]
[-NoPublishSign]
[-OutputPath <String>]
[-Plan]
[-Profile <String>]
[-ProjectRoot <String>]
[-Runtimes <String[]>]
-Settings <ScriptBlock>
[-SkipBuild]
[-SkipInstallers]
[-SkipRestore]
[-Styles <DotNetPublishStyle[]>]
[-Target <String[]>]
[-Validate]
[<CommonParameters>]
```

[#](#member-85a1e48f2aba0868fabe9c91)

Parameter set: `Settings`

```
Invoke-DotNetPublish
-ConfigPath <String>
[-ExitCode]
[-Frameworks <String[]>]
[-JsonOnly]
[-JsonPath <String>]
[-MsBuildProperty <Hashtable>]
[-NoInteractive]
[-NoPublishSign]
[-OutputPath <String>]
[-Plan]
[-Profile <String>]
[-ProjectRoot <String>]
[-Runtimes <String[]>]
[-SkipBuild]
[-SkipInstallers]
[-SkipRestore]
[-Styles <DotNetPublishStyle[]>]
[-Target <String[]>]
[-Validate]
[<CommonParameters>]
```

[#](#member-13b2e55abc1b93dcc08b4a27)

Parameter set: `Config`

## Description

This cmdlet follows the same authoring pattern as module build cmdlets: create a config using New-ConfigurationDotNet* and run it directly, or export config first via -JsonOnly + -JsonPath.

## Examples

### Generate DotNet publish JSON from DSL without execution

```powershell
Invoke-DotNetPublish -JsonOnly -JsonPath '.\powerforge.dotnetpublish.json' -Settings {
    New-ConfigurationDotNetPublish -IncludeSchema -ProjectRoot '.' -Configuration 'Release'
    New-ConfigurationDotNetTarget -Name 'PowerForge.Cli' -ProjectPath 'PowerForge.Cli/PowerForge.Cli.csproj' -Framework 'net10.0' -Runtimes 'win-x64' -Style PortableCompat -Zip
}
```

### Run DotNet publish from existing JSON config

```powershell
Invoke-DotNetPublish -ConfigPath '.\powerforge.dotnetpublish.json' -ExitCode
```

## Parameters

**-ExitCode SwitchParameter optional**

Sets host exit code: 0 on success, 1 on failure.

**-Frameworks String[] optionalaliases: Framework**

Optional framework override for selected targets.

**-JsonOnly SwitchParameter optional**

Exports JSON config and exits without running the engine.

**-JsonPath String optional**

Output path for JSON config used with JsonOnly.

**-MsBuildProperty Hashtable optional**

Optional global MSBuild properties passed to restore, build, publish, and installer steps.

**-NoInteractive SwitchParameter optional**

Disables interactive output mode. Reserved for future UI parity.

**-NoPublishSign SwitchParameter optional**

Disables signing only for targets selected by this invocation. The configuration remains unchanged. Use for a temporary runtime smoke, not a signed release. Bundles selected by the effective profile are rejected because bundle signing follows the source publish target.

**-OutputPath String optional**

Optional publish output-path override applied to selected targets.

**-Plan SwitchParameter optional**

Builds and emits resolved plan without executing steps.

**-Profile String optional**

Optional profile override.

**-ProjectRoot String optional**

Optional project root override used to resolve relative publish inputs and outputs.

**-Runtimes String[] optionalaliases: Rid, Runtime**

Optional runtime override for selected targets.

**-Settings ScriptBlock requiredsets: Settings**

DSL settings block that emits DotNet publish objects.

**-SkipBuild SwitchParameter optional**

Disables build steps for this run.

**-SkipInstallers SwitchParameter optional**

Skips installer definitions after selected targets are filtered.

**-SkipRestore SwitchParameter optional**

Disables restore steps for this run.

**-Styles DotNetPublishStyle[] optionalaliases: Style**

Optional style override for selected targets.

Possible values: `Portable`, `PortableCompat`, `PortableSize`, `SelfContained`, `FrameworkDependent`, `AotSpeed`, `AotSize`

**-Target String[] optionalaliases: Targets**

Optional target-name filter override.

**-Validate SwitchParameter optional**

Validates configuration by planning only; does not execute run steps.

**-ConfigPath String requiredsets: Config**

Path to existing DotNet publish JSON config.

## 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:855AC9BA1B7506B53E6665DE93BFAA7526DE18F31C2F8A69401863417D021607 -->
