Including additional files in Msbuild/Octopack

Hi all,

We’re using TeamCity to build our .Net projects. Within our csproj file we’ve created an additional Target that copies some additional files into the build. in TeamCity if I look at the build log in TeamCity I can see that the files have been copied to the work directory (the output directory that TeamCity uses for the project), however Octopack doesn’t include these files in the Nuget package it’s created.

I have two questions:

  • Does Octopack include everything in the output directory, or does it use the .csproj file to determine which files are required?
  • Other than using a nuspec file, is there any way of telling Octopack to include additional files. The only reason I am against the idea of a nuspec file is that there are thousands of files, I couldn’t possibly list them all easily without lots of maintenance going forward.

Thanks for your time in advance
Regards
Al

Hi Al,

Thanks for reaching out! Let me give you a hand with those questions:

- Does Octopack include everything in the output directory, or does it use the .csproj file to determine which files are required?

It uses the csproj file.

- Other than using a nuspec file, is there any way of telling Octopack to include additional files. The only reason I am against the idea of a nuspec file is that there are thousands of files, I couldn’t possibly list them all easily without lots of maintenance going forward.

The recommended approach is always to add the files to the solution so you don’t have to do anything “extra” with Octopack. If that’s not possible, you could avoid using Octopack and instead have a dedicated Nuget Pack step in TeamCity that just packs whatever is in a specific folder. You could use MSBuild’s /P:OutputPath="C:\Path" parameter to tell MSBuild to drop the complete version of your app (Compiled files + extra files you added) to a specific path where you’ll be pointing the Nuget Pack step to.

Now, while Teamcity does have steps for Nuget Pack and Nuget push, the downside is that if you have multiple projects in your solution, you’ll need to have multiple steps for all this. I would personally have a Powershell step that uses Nuget.exe to do all the packing and pushing in a single step.

Let me know if that’ll work for you.

Best regards,
Dalmiro

Hi Dalmiro,

My solution was to add ONLY the additional files I needed into a nuspec file:

And then pass the OctoPackEnforceAddingFiles=true property to Msbuild. According to your documentation this packs all of the files listed in the .csproj file and then the others specified in the nuspec file.

Thanks for your help.

Regards,
Al

Notice:

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.