Skip to main content

Build Velopack SDK

Applies to
Windows
MacOS
Linux

The Velopack SDK is responsible for compiling releases and installers.

It is made up of:

  • Rust binaries which are re-distributed with installed apps,
  • .NET NuGet package (Velopack),
  • .NET command line tool (vpk).

In order to test the project, you need to build the Rust binaries before compiling dotnet.

Prerequisites

Debug / Test

On windows, you need to build the Rust binaries using the windows feature before running tests. On OSX, you should run cargo build instead.

git clone https://github.com/velopack/velopack.git
cd velopack/src/Rust
cargo build --features windows
cd ../../
dotnet build
dotnet test --no-build

Release / Build

This is slightly complicated, because you will need to compile Rust on x64 OSX and x64 Windows before creating the final packages.

On OSX:

git clone https://github.com/velopack/velopack.git
cd velopack/src/Rust
cargo build --release

On Windows:

git clone https://github.com/velopack/velopack.git
cd velopack/src/Rust
cargo build --release --features windows
copy {path_to_osx_update} target/release/updatemac
dotnet build -c Release /p:PackRustAssets=true

Preparing Linux

If you are on Linux (tested on Ubuntu), there are additional package pre-requisites:

sudo apt install libssl-dev pkg-config build-essential

Installing dotnet and setting up the paths are a pain, I recommend using the dotnet-install.sh script.

./dotnet-install.sh -c 6.0
./dotnet-install.sh -c 8.0

And then adding the following to the bottom of your .bashrc or .profile:

export DOTNET_ROOT="$HOME/.dotnet"
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
export PATH="$PATH:$HOME/.dotnet"
export PATH="$PATH:$HOME/.dotnet/tools"

Next, install the missing dotnet tools:

dotnet tool install -g dotnet-coverage
dotnet tool install -g nbgv

You need to verify that nbgv is working on the command line (eg. nbgv -h) before continuing. If it's not working, check that your tools installed to ~/.dotnet/tools. If you did not use the dotnet-install.sh script, dotnet could be at a different location (eg. /usr/share/dotnet) and the paths above will need to be updated.

Once dotnet is configured, you can Install Rust, typically done with the rustup script available here

To verify that Rust is installed and working correctly, you should compile the Rust binaries in src/Rust:

cargo build --target x86_64-unknown-linux-gnu --release