Include BuildEvent files
This page gives an example of extending OctoPack for when you have a PostBuild event in Visual Studio and want to include files that are not specifically part of your build, such as files that have been moved using Xcopy.
This example demonstrates the use of a PostBuild event in Visual Studio and the OctoPack option
I created a Post-Build Event using the Visual Studio Build Events feature. It uses Xcopy to move files from a path to my solution:
However, when I use OctoPack to package my solution on build my moved files are not included in the build:
This is resolved by creating a NuSpec file, and creating a files tag to tell OctoPack to take my moved files, and put them inside a folder called
bin\test in the package:
It is important to note here that for OctoPack to find and use a NuSpec file, it must be named the same as your project as seen above. For instance, in our example, the project is called
OctoFX.TradingWebsite so our NuSpec file must be called
To ensure I don't just get the files defined within the NeSpec file, I add /p:OctoPackEnforceAddingFiles=true, to tell OctoPack to also add the files it would normally add while building as well as those targeted by my files tag in the NuSpec file.
F:\Workspace\OctoFX\source>msbuild OctoFX.sln /t:Build /p:RunOctoPack=true /p:OctoPackPackageVersion=184.108.40.206 /p:OctoPackEnforceAddingFiles=true
Now my test folder and files, as well as my build files, are included in the package.
- Packaging applications
- Use the Octopus CLI to create packages
- Troubleshooting OctoPack
- Package deployments
Need support? We're here to help.