Skip to content

Instantly share code, notes, and snippets.

@adamdriscoll
Created March 10, 2017 18:39
Show Gist options
  • Save adamdriscoll/6ad1c923ce90760719dd6e79891734ad to your computer and use it in GitHub Desktop.
Save adamdriscoll/6ad1c923ce90760719dd6e79891734ad to your computer and use it in GitHub Desktop.
Create a NuGet package for a .NET project.
param($Configuration)
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
mkdir $PSScriptRoot\package -ErrorAction SilentlyContinue | Out-Null
mkdir $PSScriptRoot\package\lib -ErrorAction SilentlyContinue | Out-Null
mkdir $PSScriptRoot\package\content -ErrorAction SilentlyContinue | Out-Null
Copy-Item "$PSScriptRoot\bin\$Configuration\*.DLL" $PSScriptRoot\package\lib -Force
Copy-Item "$PSScriptRoot\bin\$Configuration\*.key" $PSScriptRoot\package\content -Force
Copy-Item "$PSScriptRoot\MyProject.nuspec" $PSScriptRoot\package -Force
& "$PSScriptRoot\..\nuget.exe" pack $PSScriptRoot\package\MyProject.nuspec
& "$PSScriptRoot\..\nuget.exe" sources add -Name Local -Source $PSScriptRoot\..\localPackages
& "$PSScriptRoot\..\nuget.exe" add MyProject.1.0.0.nupkg -source $PSScriptRoot\..\localPackages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment