Is it possible to automatically remove the
scriptcs_bin directory after the deployment process takes place?
We are currently deploying an ASP.NET MVC project. As with all ASP.NET projects, there exists a
bin directory. I assume that because we are using C# scripts during our NuGet package deployment, scriptcs copies the
bin directory to
scriptcs_bin (as per http://blog.scriptcs.net/2015/01/28/a-new-file-system/). I have tried removing said
scriptcs_bin directory during the Post-deployment phase, but it doesn’t appear to be possible within the same NuGet package deployment step.
Does anyone have any experience (or solution) around this?
Thanks for getting in touch!
That’s an interesting problem! I think you’re right - you won’t be able to remove the scriptcs_bin directory with a script that effectively runs from that directory.
There are a couple of options I can think of.
If it’s possible, you could try using PowerShell instead of C# scripts. Of course that would mean rewriting them (I don’t know how complex they are), so it might be a pain. The advantage is they don’t need to create folders or anything to run. They just execute.
Alternatively, you could do your cleanup on a subsequent step. There are Output variables you could make use of to find the deployment location from the previous Nuget step (i.e. Octopus.Action[name].Output.Package.InstallationDirectoryPath). Using that variable in a PowerShell (or C# script?) step, you could probably clean up the
Hope that helps!
A quick followup - Vanessa has pointed me at a step template that does a cleanup for you, so you wouldn’t have to write your own script for Option 2.
I hope it helps!
Thanks for the info Damian.
I resorted to using PowerShell instead of C#, however, it looks like the PowerShell script linked will do the necessary cleanup.