Unpacking a nuget without prefix

Hey guys,

I’ve set all my files to be written to \bin in my .sln - and I guess because of that, the .nupkg created has all the files created in \bin

Then, when the deployment unpacks the package in the directory I have set, (c:\bin), I get the files in c:\bin\bin which is obviously not desirable.

How can I fix this?


Hi Georgios,

Thanks for getting in touch! There are two ways to fix this. One is to create the install directory to be a directory back ie "C:"
The second is to create a NuSpec file and add a files element that targets the bin directory but tells the target to be in the root of the package such as:

  <file src="bin\*.*" target="" />

An example of using a NuSpec file with OctoPack can be found here: http://docs.octopusdeploy.com/display/OD/OctoPack+to+include+BuildEvent+files

Hope that helps!

Thanks Vanessa

I did think of the “one up” solution but I didn’t think that Octopus purging my C:\ drive would be a good idea :slight_smile:

Re the nuspec solution, given that there are multiple projects that gets output in bin\ - is Octopus smart enough to know that bin*.* actually means “all files from this project” or will I get a package containing everything?

HI Georgios,

Yeah totally spaced on the purging C:\ concept. Good catch :wink: It’s good to laugh at ones stupidity right? But to be a little fair you can select not to purge … though seems fraught with danger.
Defining files does grab everything from that directory and not just what’s built - you really are trying to make this difficult! Are there any defining features to separate the files in the bin\ in the project because you can exclude files in the files element such as: <file src="bin\*.*" target="" exclude="*.log">
The only other thing I can think of is to move the files after the fact using a PowerShell step.


Yeah I’ll agree perfectionism often gets in the way :slight_smile: I like purging the directory because it will sometimes contain stuff that should not be kept across releases.

FYI - I put all the built files in the same directory because it accelerates build times. It makes quite a difference even on an SSD computer.

I like the powershell idea better, hadn’t thought of that, thanks!