Skip to main content

Getting Started: .NET

Applies to
Windows
MacOS
Linux

Get started with .NET 5+ (cross-platform) or .Net Framework.

  1. Install the Velopack NuGet Package in your main project:
    dotnet add package Velopack
  2. Configure your Velopack app at the beginning of Program.Main:
    static void Main(string[] args)
    {
    VelopackApp.Build().Run();
    // ... your other startup code below
    }
  3. Add automatic updating to your app:
    private static async Task UpdateMyApp()
    {
    var mgr = new UpdateManager("https://the.place/you-host/updates");

    // check for new version
    var newVersion = await mgr.CheckForUpdatesAsync();
    if (newVersion == null)
    return; // no update available

    // download new version
    await mgr.DownloadUpdatesAsync(newVersion);

    // install new version and restart app
    mgr.ApplyUpdatesAndRestart(newVersion);
    }
  4. Install the command line tool vpk:
    dotnet tool update -g vpk
  5. Publish dotnet and build your first Velopack release! 🎉
    dotnet publish yourApp.csproj -c Release --self-contained -r win-x64 -o .\publish
    vpk pack -u YourAppId -v 1.0.0 -p .\publish -e yourMainApp.exe
    tip

    Starting with .NET 7, the -o/--output option can no longer be used with a solution file. If you execute the dotnet publish command from within the same directory as the .csproj file, you can omit the project argument. You can find more details on the dotnet publish documentation.

✅ You're Done! Your app now has auto-updates and an installer. You can upload your release to your website, or use the vpk upload command to publish it to the destination of your choice.