Search code examples
powershellnugetoctopus-deploy

How can I make Octopus execute ps1 scripts in the content folder in a NuGet package?


When I use the nuget pack functionality in Azure DevOps, it creates a NuGet package with all the project files in the content folder. This includes some scripts like PostDeploy.ps1.

When Octopus Deploy tries to release this, it says it won't execute the ps1 scripts because they're in a subfolder, instead of the root folder ( = next to the content folder).

Now, Octopus encourages using NuGet packages, and these ps1 scripts are in the root of the project. So I would assume that there's an obvious solution that I'm not seeing here.

How can I make Octopus run these Pre-/Post-Deploy scripts?


Solution

  • I ultimately solved this by not using NuGet itself for this at all.

    Instead we used the OctoPack NuGet package.
    This package creates Octopus-compliant NuGet packages via msbuild.