Auto Package Creation via VS Post Build Event

Dec 29, 2011 at 1:27 PM

I create packages automatically from project file with a PS script. I am not sure if there is any better way of doing this. Here is the script I use:

param ([string]$solutionDir, [string]$projectPath)

if((Test-Path "$solutionDir\nugetPacks") -eq $false) {
    Write-Host "nugetPacks folder does not exists. Creating one..."
    mkdir "$solutionDir\nugetPacks"
}

sal __Nuget ($solutionDir + "tools\NuGet.exe")
__Nuget pack $projectPath -OutputDirectory ($solutionDir + "nugetPacks")

This is the post build event:

powershell -file "$(SolutionDir)tools\pack.ps1" $(SolutionDir) $(ProjectPath)

This works fine. Am I on the right path here?

Dec 29, 2011 at 3:35 PM

The NuGet Power Tools "Enable-PackageBuild" command might be an alternative way to achieve what you need.