mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
1.4 KiB
1.4 KiB
Applies to: Windows, MacOS, Linux
Getting Started: C# / .NET
- Install the command line tool
vpk:dotnet tool update -g vpk - Install the Velopack NuGet Package in your main project:
dotnet add package Velopack - Configure your Velopack app at the beginning of
Program.Main:static void Main(string[] args) { VelopackApp.Build().Run(); // ... your other startup code below } - 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(); } - Publish dotnet and build your first Velopack release! 🎉
dotnet publish -c Release --self-contained -r win-x64 -o .\publish vpk pack -u YourAppId -v 1.0.0 -p .\publish -e yourMainApp.exe - Upload the files created by Velopack to
https://the.place/you-host/updates
If you're not sure how these instructions fit into your app, check the example apps for common scenarios such as WPF or Avalonia.