Skip to content

How to build from source

Jan edited this page Jun 23, 2023 · 9 revisions

Introduction

Duplicati is a C# project for Windows, with code access via Git. All software can be obtained for free (though restricted via their own licenses). This is a short guide with instructions for obtaining the source code checkout and building Duplicati from that.

Obtain the source code

Windows and Mac users can try Source Tree (although it looks like it requires either a bitbucket or atlassian account), Linux users have other options for Git.

Use your Git client and clone this URL: https://github.com/duplicati/duplicati.git

Build the source

Windows users can try either VS Community Edition, Xamarin Studio or SharpDevelop. When using VS you'll also have to install the NUnit 3 Test Adapter in order for executing the unit tests.

Mac users will want to use Xamarin Studio.

Linux users will want to use MonoDevelop, unless you just want to build, in which case you should look for the xbuild utility in your package manager. If you encounter a warning like Warning: this build does not support GTK, rebuild with ENABLE_GTK defined, you may need to create a file <repository root>/Duplicati/GUI/Duplicati.GUI.TrayIcon/Duplicati.GUI.TrayIcon.csproj.user with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <DefineConstants>$(DefineConstants),ENABLE_GTK</DefineConstants>
  </PropertyGroup>
</Project>

Other than that, Duplicati should build straight away (all batteries included) on all three platforms, using either xbuild, msbuild or an IDE. The MacTrayIcon project only builds with Xamarin Studio on OSX, but it will be ignored on other platforms and by xbuild/msbuild.

If you use an IDE you should set the Duplicati.GUI.TrayIcon project as the startup project and just press run, and you should be ready (remember to exit running instances first).

Troubleshooting for Windows (Visual Studio)

  • If there are problems with .NET versions, other versions might need to be installed using the Visual Studio Installer.
  • Nuget packages can be broken when first opening the solution. If restore via right click does not work, the nuget exe might work: nuget restore Duplicati.sln
  • Currently there are old System.Net.Http binding redirects that cause exceptions at runtime. They can be removed from all app.config files:
<bindingRedirect oldVersion="0.0.0.0-4.1.1.3" newVersion="4.2.0.0" />

Building the installer and redistributable binaries

The "Installer" folder has some tools and various help files for building native packages for different operating systems. Generally the build is fully cross platform, so you can build on one platform and run on another. The tools for building the packages are usually only found on the OS in question though (e.g. you cannot make an RPM package on Windows).

The OSX version needs Xamarin Studio to build the tray icon, but the rest works fine. The GTK version is also working on OSX, but does not look native.

When building on Windows, you need to enable the preprocessor macro __WindowsGTK__ and link in the GTK libraries if you want a cross platform build with a GTK tray icon.

The GitHub Action workflow "Build release installers" can be triggered manually in forks to build installers (but artifacts are only kept for 5 days).