deadlydog/New-NuGetPackage
Fork: 9 Star: 24 (更新于 2024-11-08 18:34:12)
license: MIT
Language: PowerShell .
New-NuGetPackage.ps1 is a PowerShell script to make creating and publishing NuGet packages quick and easy, using a .nuspec or project file, from File Explorer or PowerShell.
最后发布版本: v1.5.11 ( 2018-10-18 12:01:58)
New-NuGetPackage PowerShell Script Description
New-NuGetPackage.ps1 is a PowerShell script to make creating and publishing NuGet packages quick and easy, using a .nuspec or project file, from Explorer or PowerShell.
This script is also used by a NuGet Package that you can use to automate making your project's NuGet packages in Visual Studio.
This script depends on nuget.exe, and it is recommended that you add nuget to your PATH.
[!NOTE] This script and package is most useful for .NET Framework projects. .NET Core projects can natively be configured to create a NuGet package on every build, and it can be published from the command-line with
dotnet nuget push
.
Features
- The script uses nuget.exe to pack a .nuspec or project file (.csproj, .vbproj, .fsproj) and optionally push it to a NuGet gallery.
- Can be ran from PowerShell or directly from Windows Explorer (e.g. double-click it, or right-click -> Run with PowerShell).
- If no parameters are provided the user will be prompted for:
- the .nuspec or project file to pack, or package to push (if one can't be found automatically)
- the version number and release notes to use for the package (if a .nuspec file is used)
- whether the package should be pushed to a NuGet gallery or not.
- Parameters may be provided to supply these values and/or suppress the prompts, so it can be integrated into your build system.
The script provides parameters for the Pack and Push Options, which will be passed as-is to nuget.exe, allowing for all of the same functionality as calling nuget.exe directly yourself.
Getting Started Quickly
Here are a couple examples of how to run the script from PowerShell to have the GUI prompt you for the required parameters:
& .\New-NuGetPackage.ps1 # Can use relative path when in same directory as the script.
& "C:\Some Folder\New-NuGetPackage.ps1" # Use absolute path to run script from anywhere.
Below are some examples of calling the script with parameters to avoid the GUI prompts. For more information on the script and its parameters, check out the documentation.
& ".\New-NuGetPackage.ps1" -NuSpecFilePath ".\Some Folder\SomeNuSpecFile.nuspec"
& .\New-NuGetPackage.ps1 -ProjectFilePath "C:\Some Folder\TestProject.csproj" -VersionNumber "1.1" -ReleaseNotes "Version 1.1 contains many bug fixes."
& .\New-NuGetPackage.ps1 -ProjectFilePath "C:\Some Folder\TestProject.csproj" -PackOptions "-Build -OutputDirectory ""C:\Output""" -UsePowerShellPrompts
& .\New-NuGetPackage.ps1 -NuSpecFilePath "C:\Some Folder\SomeNuSpecFile.nuspec" -NoPrompt
& .\New-NuGetPackage.ps1 -NuSpecFilePath ".\Some Folder\SomeNuSpecFile.nuspec" -VersionNumber "9.9.9.9" -DoNotUpdateNuSpecFile
& .\New-NuGetPackage.ps1 -PushPackageToNuGetGallery -PushOptions "-Source ""http://my.server.com/MyNuGetGallery"" -ApiKey ""EAE1E980-5ECB-4453-9623-F0A0250E3A57"""
& .\New-NuGetPackage.ps1 -NuGetExecutableFilePath "C:\Utils\NuGet.exe"
& .\New-NuGetPackage.ps1 -PackageFilePath "C:\Some Folder\MyPackage.nupkg"
主题(topics):
hacktoberfest, nuget, nuget-packages, powershell-module, powershell-script
deadlydog/New-NuGetPackage同语言 PowerShell最近更新仓库
2024-11-18 03:45:03 ntdevlabs/tiny11builder
2024-10-08 04:38:35 ChrisTitusTech/winutil
2024-09-24 22:59:06 jenkinsci/docker
2024-08-14 03:12:36 PSAppDeployToolkit/PSAppDeployToolkit
2024-08-04 15:03:04 dataplat/dbatools
2024-07-19 04:02:17 actions/runner-images