Can not execute PreDeploy.ps1 for Windows Service

Using Octopus Deploy 2.6 and encountered a problem when trying to include a PreDeploy.ps1 with a windows service deployment.

File settings are as per documentation for windows service:
Build Action is set to "None"
Copy to Output Directory is set to “Copy if newer”

I still get:
“The script file “bin\PreDeploy.ps1” contained within the package will not be executed because it is contained within a child folder. As of Octopus Deploy 2.4, scripts in sub folders will not be executed.”

Any way to get around this?


Hi Freddy,

Thanks for reaching out. Was the PreDeploy.ps1 file added to the root of your solution (as shown on the attached screenshot) ?



Hi Dalmino

Placed on the root of the project yes, root of solution no (would that make any sense?)
Also, cannot see any attached screenshot.


Problem solved

Followed the guidelines for ASP.NET instead of those for windows service, even though it is a windows service I am deploying.

Must use “Build Action” = “Content” and “Copy to Output Directory” = “Do not copy”

Either your guide is wrong / out of date or my set up is strange, which I don’t see how it is. Anyway, it works fine now.