# Publish-NugetPackage

Pushes NuGet packages to a feed using dotnet nuget push.

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`

Pushes NuGet packages to a feed using dotnet nuget push.

## Syntax

```
Publish-NugetPackage
-ApiKey <String>
-Path <String[]>
[-SkipDuplicate]
[-Source <String>]
[<CommonParameters>]
```

[#](#method-publish-nugetpackage-string-string-switchparameter-string)

Parameter set: `Source`

```
Publish-NugetPackage
[-ApiKey <String>]
[-InstallPrerequisites]
-Path <String[]>
-ProfileName <String>
[-SkipDuplicate]
[<CommonParameters>]
```

[#](#method-publish-nugetpackage-string-switchparameter-string-string-switchparameter)

Parameter set: `Profile`

## Description

Searches the provided -Path roots for *.nupkg files and pushes them using the .NET SDK.

Use -SkipDuplicate for CI-friendly, idempotent runs.

## Examples

### Publish all packages from a Release folder

```powershell
Publish-NugetPackage -Path '.\bin\Release' -ApiKey $env:NUGET_API_KEY -SkipDuplicate
```

Publishes all .nupkg files under the folder; safe to rerun in CI.

### Publish to a custom feed

```powershell
Publish-NugetPackage -Path '.\artifacts' -ApiKey 'YOUR_KEY' -Source 'https://api.nuget.org/v3/index.json'
```

Use a different source URL for private feeds (e.g. GitHub Packages, Azure Artifacts).

### Publish to a saved Azure Artifacts profile

```powershell
Publish-NugetPackage -Path '.\artifacts' -ProfileName 'Company' -InstallPrerequisites -SkipDuplicate
```

Resolves the Azure Artifacts NuGet v3 source from the saved profile, installs missing credential-provider prerequisites when requested, and lets the Azure Artifacts Credential Provider handle Entra-backed authentication.

## Parameters

**-ApiKey String required in Source**

API key used to authenticate against the NuGet feed. For Azure Artifacts profiles this defaults to a non-secret placeholder used by NuGet clients; for GitHub Packages profiles this defaults from GITHUB_TOKEN or GH_TOKEN.

**-Path String[] required**

Directory to search for NuGet packages.

**-SkipDuplicate SwitchParameter optional**

When set, passes --skip-duplicate to dotnet nuget push. This makes repeated publishing runs idempotent when the package already exists.

**-Source String optionalsets: Source**

NuGet feed URL.

**-InstallPrerequisites SwitchParameter optionalsets: Profile**

Installs missing private-gallery prerequisites before profile-backed Azure Artifacts package publishing.

**-ProfileName String requiredaliases: Profilesets: Profile**

Saved private gallery profile name for Azure Artifacts package publishing.

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