Skip to content

Instantly share code, notes, and snippets.

@DanubeRS
Created November 17, 2015 04:05
Show Gist options
  • Select an option

  • Save DanubeRS/080c98fbb4f6cc22d06c to your computer and use it in GitHub Desktop.

Select an option

Save DanubeRS/080c98fbb4f6cc22d06c to your computer and use it in GitHub Desktop.
Simple NuGet PS script
param([switch] $Pack, [string] $Version, [switch] $Push, [string] $ApiKey, [switch] $Clean)
if ($Pack)
{
$Title = "Package Versions"
$Message = "In addition to specifying -Version you need to set the assembly version(s) " +
"via the AssemblyVersionAttribute. Click 'Yes' to continue or 'No' to stop.";
$Yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "I have set the version.";
$No = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "I have not set the version.";
$Options = [System.Management.Automation.Host.ChoiceDescription[]]($Yes, $No);
switch ($Host.UI.PromptForChoice($Title, $Message, $Options, 0))
{
# 1 is the index of "No"
1 { Return }
}
# Set the version using AssemblyVersionAttribute
nuget Pack .\Binder.Tools.Core.csproj `
-Build -Symbols -IncludeReferencedProjects -Properties Authors=Binder`;Configuration=Release;
Write-Host "---"
}
if ($Push)
{
nuget Push Binder.Tools.Core*.nupkg -s https://www.myget.org/F/edocx/api/v2/package
Write-Host "---"
}
if ($Clean)
{
Remove-Item Binder.Tools.Core.*.nupkg
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment