Octo.exe is a command line tool that interacts with the Octopus Deploy REST API and includes a
pack command to create packages either as Zip or NuGet packages for deployment with Octopus. You can learn more about NuGet and NuGet Packages on the official NuGet website.
We recommend installing Octo as a global tool using .NET Core which makes Octo available as a command via the .NET CLI.
If you have the .NET Core
2.1.300 SDK available you can install Octo onto a machine or build agent as a global tool with the following command:
dotnet tool install Octopus.DotNet.Cli --global
For more installation details, options, and update instructions, see Octo Command Line Global Tool.
At a minimum
octo pack requires an ID to be provided:
dotnet octo pack --id="OctoWeb"
The above command will generate a package in the current working directory and provide a timestamp based version number such as
If you want to provide your own version, you can pass the
--version parameter in the call to Octo:
dotnet octo pack --id="OctoWeb" --version="1.0.0"
You can also change the output directory and folder which will be packed with the
--basePath parameters respectively.
dotnet octo pack --id="OctoWeb" --version="1.0.0" --basePath="folder/to/pack" --outFolder="destination/folder/path"
You specify the format of package we want to use with the
dotnet octo pack --id="OctoWeb" --version="1.0.0" --format=zip
For a full list of the
pack command options see Octo.exe Command Line Pack or run the following command:
C:\> dotnet octo help pack
Creating Zip Packages
You can use any zip program or library to create your packages, however, using Octo will:
- Help you get the filename format correct.
- Ensure file timestamps are retained when extracting which helps with some forms of content delivery networks (CDN) and caching.
- Ensure delta compression for package transfers works as expected.
- Avoid known issues with other compression libraries.
To create a zip package of the application, open a command prompt and change into the directory where the application is located:
Call Octo with the
pack command, provide a package ID, specify the format, and any other parameters you want to use:
C:\Code\OctoWeb\OctoWeb\OctoWeb\bin> dotnet octo pack --id=OctoWeb --version=188.8.131.52 --format=zip Octopus Deploy Command Line Tool, version 3.3.8+Branch.master.Sha.f8a34fc6097785d7d382ddfaa9a7f009f29bc5fb Packing OctoWeb version 184.108.40.206... Saving OctoWeb.220.127.116.11.zip to C:\Code\OctoWeb\OctoWeb\OctoWeb\bin... Done. C:\Code\OctoWeb\OctoWeb\OctoWeb\bin> dir *.18.104.22.168.zip Directory: C:\Code\OctoWeb\OctoWeb\OctoWeb\bin Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 9/03/2016 12:31 PM 43624075 OctoWeb.22.214.171.124.zip
Open the created zip package and you should see the package contains all the same files as the output folder of your build.
Packaging a .NET Core application
To package a .NET core application, first publish the application, and then call
octo pack on the output folder for example:
dotnet publish ./OctoWeb.csproj --output ./dist dotnet octo pack ./dist --id="OctoWeb" --version="1.0.0"
Please refer to Microsoft's publish and packing documentation for more information.
Packaging a .NET Core Library
If you are using .NET Core for class libraries, we recommend using dotnet pack from Microsoft.
dotnet pack ./SomeLibrary.csproj --output ./dist dotnet octo pack ./dist --id="SomeLibrary" --version="1.0.0"
Packaging a .NET Framework Web application
There are usually some extra steps required to get the resulting application built and deployable. Full framework web applications are a good example of this, where simply building the application will not give you the desired output. We still recommend Octopack for these cases. However, you may be able to achieve this using msbuild parameters such as:
msbuild ./OctoWeb.csproj /p:DeployDefaultTarget=WebPublish /p:DeployOnBuild=true /p:WebPublishMethod=FileSystem /p:SkipInvalidConfigurations=true /p:publishUrl=dist dotnet octo pack ./dist --id="OctoWeb" --version="1.0.0-alpha0001"
Packaging Your Application From a Folder
If you have a build process which places all build outputs into a final destination folder (such as gulp, grunt or webpack), you can package it using octo as well. For example, let's assume you have defined an npm script which runs your build and places all associated content into the
npm run build dotnet octo pack ./dist --id="OctoWeb" --version="1.0.0"