---
title: "Create NuGet Package"
---
Creates a NuGet package from a project or .nuspec file (requires Windows).
NuGet::Create-Package(
SourceFile: <text>,
[Verbose: <true/false>],
[Version: <text>],
[Symbols: <true/false>],
[Build: <true/false>],
[Properties: <@(text)>],
[IncludeReferencedProjects: <true/false>],
[OutputDirectory: <text>],
[SourceDirectory: <text>],
[NuGetExePath: <text>],
[Arguments: <text>]
);
Name | Format | Script Usage | Usage Notes |
---|---|---|---|
☆ Source file (default) | text | SourceFile | The .nuspec or MSBuild project that will be passed to NuGet.exe. This argument is required. |
Verbose logging | true/false | Verbose | |
Version | text | Version | The package version that will be passed to NuGet.exe. |
Symbols | true/false | Symbols | When true, the -Symbols argument will be passed to NuGet.exe. |
Build | true/false | Build | When true, the -Build argument will be passed to NuGet.exe. |
Properties | @(text) | Properties | When Build is true, these values will be passed to NuGet.exe as MSBuild properties in the format PROP=VALUE. |
Include ref. projects | true/false | IncludeReferencedProjects | When true, the -IncludeReferencedProjects argument will be passed to NuGet.exe. |
Output directory | text | OutputDirectory | The output directory that will be passed to NuGet.exe. |
Source directory | text | SourceDirectory | The working directory to use when executing NuGet. Default value is "$WorkingDirectory". |
NuGet.exe path | text | NuGetExePath | Full path to NuGet.exe on the target server. When not set, the included nuget.exe will be used. This will only be used if dotnet is not available on a Windows server or PreferNuGetExe is set to true. Default value is "$NuGetExePath". |
Additional arguments | text | Arguments | When specified, these arguments will be passed to NuGet.exe verbatim. |