How to extract package content without running powershells scripts

andrim's Avatar


08 Jan, 2018 04:24 PM

As I understand when Extract nuget package step is executed it runs powershell scripts from the root of the nuget package if any. Is it possible to extract the package without them being run or reference files within the package without extracting it as a whole?

I'm trying to retrieve deployment details that are inside the package that need manual review before final deployment.

  1. Support Staff 1 Posted by Tom Williams on 09 Jan, 2018 12:59 AM

    Tom Williams's Avatar

    Hi Andrim,
    Thanks for reaching out. For the scenario you are describing, the best approach would be to use the "Transfer a Package" deployment step, this will allow you to transfer the package to deployment targets without extracting or running any scripts. you can then manually extract the package and perform any necessary checks. If you were to run a "Deploy a Package" step later in the deployment process, it will use the same package that was transferred as part of the "Transfer a Package" step.

    I hope that helps, let me know if you have any further questions.
    Kind Regards,

  2. 2 Posted by andrim on 10 Jan, 2018 11:01 AM

    andrim's Avatar

    I ended up doing the following to get reports from ReadyRoll. Rather cumbersome for what you might think was trivial :)

    #Expects that package transfer task with name 'Transfer DB Package' be done beforehand
    $packageNameWithVer = '#{Octopus.Action[Transfer DB package].Output.Package.FileName}'-Replace '.nupkg','';
    $projectName = 'ReadyRollTest';

    Write-Host 'Extracting database nuget package';
    E:\Nuget\nuget.exe install #{Octopus.Action[Transfer DB package].Package.PackageId} -OutputDirectory Extracted -Source #{Octopus.Action[Transfer DB package].Package.TransferPath}

    Write-Host 'Creating DB artifact'
    $p = '.\Extracted\'+$packageNameWithVer
    $p += "\obj\Release\" + $projectName;

    Write-Host 'Report location, '+$p
    New-OctopusArtifact -Path $p'.html' -Name "ChangeReport.html"
    if( Test-Path $p'_ReSync.html' )
    New-OctopusArtifact -Path $p'_ReSync.html' -Name "ReSyncReport.html"
    New-OctopusArtifact -Path $p'_ReSync.sql' -Name "ReSyncScript.sql"
    Write-Host 'Empty Temp directory, #{Octopus.Action[Transfer DB package].Package.TransferPath}'
    get-childitem "#{Octopus.Action[Transfer DB package].Package.TransferPath}" -recurse | foreach {$_.Delete()}

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac