How to include a folder and its contents in a CLI project in Nuget Package packed by OctoPack

We have a CLI Project in our solution.

In it, we have a folder called “migrations” that has all the .sql files that must be run as db migrations during a deploy.

It appears that during a build, the NuGet package is not packing up this folder and its contents.

How do we do this?

Hi Mevans,
Have you configured the .sql resources in Visual Studio such that their file property Copy to Output Directory is set to Copy always? If this is set these files should get copied to the build directory and subsequently included in the NuGet package.
Let me know if this does not fix your issue.
Cheers,
Robert

@robert,

That would work, but ideally we could set that on the folder. Not each file.
Asking a developer to remember that each time seems like it will be a recurring mistake.

And it doesn’t seem like you can set an entire folder to have this action, which would have worked perfectly.

Any other options?

Hi Mevans,
Another approach which might suit your needs is to add the required files into your nuspec file. You can then add the /p:OctoPackEnforceAddingFiles=true argument to the msbuild task so that when OctoPack runs, it includes both the folders/files explicitly listed in your nuspec file, and those that are produced as part of the build. Further details on this option are available in our documentation at http://docs.octopusdeploy.com/display/OD/OctoPack+to+include+BuildEvent+files

This should allow you to set up the included folder once, and then any files that your developer adds to the project will automatically get bundled up into the nupkg!
Hope this solves your problem.
Cheers,
Robert

@Robert,

This is exactly what we have ended up doing.

Thank you so much, it worked great!