I need to be able to extract the package file as part of our teamcity build, is this possible?
Most of our deployments use octopus and the nupkg that are created, however, there are other ones that don’t. For these, we need the actual packaged files. What we’ve been doing is using a /t:publish on the project, but this generates a second, large, artifact.
What I’ve tried is extracting it as if it was a zip file, however, paths with a space come out as %20 and I’m sure there are other nuances with this approach.
I’ve also tried using the nuget.exe to “install” the package, but that doesn’t work either (I’m assuming because nuget.exe expects a framework folder).
I’m not sure I totally understand your scenario, so I’m gonna hold on to my answer until I know we are on the same page.
Let me know if this is close enough:
Let’s say you have 1 solution with 3 projects on it
When you build your solution, you get a nuget package out of each of those projects. Projects A and B are deployed using Octopus, so having them on a nuget package makes total sense. But Project C isn’t deployed using Octopus, so having it on a nuget package is not so convenient.
Is that similar enough to your scenario? If its not please try to describe it the same way I did.
It’s 1 project, we just deploy it in 2 ways. Most of our environments get it through our octopus server, but some can’t be done that way (not going into the reason as it’s not relevant. For the ones that can’t, we need the files. I want to get the files out of the nupkg, instead of doing things (and storing the artifacts) twice, once for each.
MSBuild puts your compiled code on the output directory
MSBuild invokes the Octopack task, which creates a nuget package with the files declares in your csproj file.
Instead of extracting the package created in (3), wouldn’t it be easier to grab the compiled app that’s already sitting on your TeamCity agent since step (2)? I’m sure TeamCity has a variable that has the exact path where MSBuild put the files after compiling.
If only it was that simple. I think you need the full scenario to appreciate it.
So, we trigger a build in TeamCity on every commit. This will generate a nuget package for each project, and on top of that, it publishes all the webforms code to a single location so this then becomes an artifact (generating around 600-700mb of artifacts. At some point, a customer (who is not part of octopus deploy infrastructure) may need a deployment, which then requires us to “package” the publish files into a custom format.
The issue is that this means we’re storing around 500mb more artifacts that we actually need, or generating extra load on the build server/process to compress this.
As we have the nugets, and they contain all the code, it makes sense to simply keep them, and extract the contents when required. This would be done in a dependent build at a later time, so all I need is to be able to extract the nuget’s contents properly (with encoding).
Thanks for taking the time to give me the full context. Nuget.exe install seems to be exactly what you need. I just tested it on my end as shown on the link below and it simply extracts the content of the package into a folder like you need
My package only contained a .jpg file, withouth and kind of “framework” folder.
That’s actually the first article I found too. However, no matter how I try to do it, it doesn’t find the package.
package is labelled Tachyon.7.8.1.nupkg and is in c:\temp\nuget
when I run .\nuget.exe install -Source “c:\temp\nuget” -OutputDirectory “c:\temp\output” All I get is:
Unable to find package ‘Tachyon’
Nuget version is 3.3
Tachyon package contents look like the attached. It does normally have a lib folder in there that’s empty, but I tried removing that just in case.
I’ve made sure my syntax is right by adding in a package that is a proper nuget package into the same directory and it works fine. I think the proof is that doing a nuget list on that source only returns the one downloaded from nuget too.
This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.