### Install Dependencies and Start Development Server Source: https://github.com/velopack/velopack.docs/blob/master/AGENTS.md Install project dependencies and start the local development server for real-time updates. Access the site at http://localhost:3000. ```bash # Install dependencies npm install # Start development server (http://localhost:3000) npm run start ``` -------------------------------- ### Create Desktop Shortcut After Install Source: https://github.com/velopack/velopack.docs/blob/master/docs/integrating/shortcuts.mdx This example demonstrates how to use the `VelopackApp.Build()` API to create a shortcut on the Desktop after a fast installation. ```csharp using Velopack; using Velopack.Windows; VelopackApp.Build() .OnAfterInstallFastCallback((v) => new Shortcuts().CreateShortcutForThisExe(ShortcutLocation.Desktop)) .Run(); ``` -------------------------------- ### update.exe start Command Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cli/content/update-windows.mdx Starts the currently installed application. Use '[EXE_ARGS]...' to pass arguments to the started executable. ```bash update.exe start: Starts the currently installed version of the application --waitPid Wait for the specified process to terminate before applying the update -h, --help Print help [EXE_ARGS]... Arguments to pass to the started executable. Must be preceded by '--'. [EXE_NAME] The optional name of the binary to execute ``` -------------------------------- ### UpdateNix_x64 start Subcommand Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cli/content/update-linux.mdx Explains the 'start' subcommand for launching the installed application, with options to wait for process termination and pass arguments to the executable. ```bash UpdateNix_x64 start: Starts the currently installed version of the application --waitPid Wait for the specified process to terminate before applying the update -h, --help Print help [EXE_ARGS]... Arguments to pass to the started executable. Must be preceded by '--'. [EXE_NAME] The optional name of the binary to execute ``` -------------------------------- ### UpdateMac Start Command Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cli/content/update-osx.mdx The 'start' command launches the currently installed application version. It can also wait for a specific process to finish before starting. ```bash UpdateMac start: Starts the currently installed version of the application --waitPid Wait for the specified process to terminate before applying the update -h, --help Print help [EXE_ARGS]... Arguments to pass to the started executable. Must be preceded by '--'. [EXE_NAME] The optional name of the binary to execute ``` -------------------------------- ### Install .NET 9.0 SDK (x64) Source: https://github.com/velopack/velopack.docs/blob/master/docs/packaging/bootstrapping.mdx Example of specifying the .NET 9.0 SDK for x64 architecture. ```cmd --framework net9.0-x64-sdk ``` -------------------------------- ### Install .NET 6.0 Desktop Runtime (x64) Source: https://github.com/velopack/velopack.docs/blob/master/docs/packaging/bootstrapping.mdx Example of specifying the .NET 6.0 Desktop Runtime for x64 architecture. ```cmd --framework net6.0-x64-desktop ``` -------------------------------- ### Install .NET 5.0 AspNetCore (x86) Source: https://github.com/velopack/velopack.docs/blob/master/docs/packaging/bootstrapping.mdx Example of specifying the .NET 5.0 AspNetCore runtime for x86 architecture. ```cmd --framework net5.0-x86-aspnetcore ``` -------------------------------- ### Install .NET 8.0 Runtime (arm64) Source: https://github.com/velopack/velopack.docs/blob/master/docs/packaging/bootstrapping.mdx Example of specifying the .NET 8.0 Runtime for arm64 architecture. ```cmd --framework net8.0-arm64-runtime ``` -------------------------------- ### onFirstRun Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/js/VelopackApp.md Registers a callback to be triggered when the application is started for the first time after installation. ```APIDOC ## onFirstRun(callback) ### Description Registers a callback to be triggered when the application is started for the first time after installation. ### Method onFirstRun ### Parameters #### Path Parameters - **callback** (VelopackHook) - Description not specified in source ### Returns VelopackApp ``` -------------------------------- ### Setup .NET SDK Action Source: https://github.com/velopack/velopack.docs/blob/master/docs/distributing/github-actions.mdx Installs a specific version of the .NET SDK required for compiling the application. Ensure 'dotnet-version' matches your project's requirements. ```yaml - name: Install .NET uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x ``` -------------------------------- ### Runtimes.VCRedist00.DownloadUrl Property Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/Runtimes.VCRedist00.md Gets the permalink to the installer for this runtime. ```APIDOC ## DownloadUrl Property ### Description Permalink to the installer for this runtime. ### Returns `string` - The URL to the installer. ``` -------------------------------- ### Per-Machine MSI Installation Source: https://github.com/velopack/velopack.docs/blob/master/docs/packaging/operating-systems/windows.mdx Illustrates the command-line arguments for creating a per-machine MSI installer, specifying the installation location and requiring elevation. ```bash Setup.exe --msi --instLocation PerMachine ``` -------------------------------- ### Install Dependencies Source: https://github.com/velopack/velopack.docs/blob/master/README.md Run this command to install all required project dependencies. ```bash $ yarn ``` -------------------------------- ### Install Linux Development Packages Source: https://github.com/velopack/velopack.docs/blob/master/docs/contributing/compiling.mdx Installs essential development libraries required for building native Rust components on Ubuntu. Run this command before proceeding with other setup steps. ```shell sudo apt-get install -y libgtk-3-dev libx11-dev libxext-dev libxft-dev libxinerama-dev libxcursor-dev libxrender-dev libxfixes-dev libpango1.0-dev libgl1-mesa-dev libglu1-mesa-dev libpipewire-0.3-dev libclang-dev libgbm-dev libegl-dev libwayland-dev ``` -------------------------------- ### Install AppImageLauncher on Ubuntu Source: https://github.com/velopack/velopack.docs/blob/master/docs/packaging/operating-systems/linux.mdx Use these commands to add the PPA and install AppImageLauncher on Ubuntu systems. ```bash sudo add-apt-repository ppa:appimagelauncher-team/stable sudo apt install software-properties-common appimagelauncher ``` -------------------------------- ### DownloadUrl Property Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/Runtimes.FrameworkInfo.md Gets a permalink to the installer for this runtime. ```APIDOC ## DownloadUrl Property ### Description Permanent link to the installer for this runtime. ### Returns (string) - The download URL for the runtime installer. ``` -------------------------------- ### Installing to a Custom Directory Source: https://github.com/velopack/velopack.docs/blob/master/docs/packaging/operating-systems/windows.mdx Demonstrates how to specify a custom installation directory for the Velopack installer at runtime using the '--installto' argument. ```bash Setup.exe --installto "C:\Custom\Install\Path" ``` -------------------------------- ### Install .NET SDK using dotnet-install.sh Source: https://github.com/velopack/velopack.docs/blob/master/docs/contributing/compiling.mdx Downloads and installs a specific version of the .NET SDK using the official installation script. This is recommended for managing .NET installations on Linux. ```shell ./dotnet-install.sh -c 10.0 ``` -------------------------------- ### Install vpk as a .NET Global Tool Source: https://github.com/velopack/velopack.docs/blob/master/docs/getting-started/content/_install-vpk.mdx Install the vpk command-line tool globally using the .NET SDK. Ensure you have the .NET SDK installed first. ```cmd dotnet tool install -g vpk ``` -------------------------------- ### OnFirstRun Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cpp/VelopackApp.md Registers a hook that is triggered when the application is started for the first time after installation. ```APIDOC ## OnFirstRun ### Description This hook is triggered when the application is started for the first time after installation. ### Method OnFirstRun ### Parameters #### Path Parameters - **cbFirstRun** (vpkc_hook_callback_t) - Required - The callback to run when the application is started for the first time. ### Returns A reference to the builder. ``` -------------------------------- ### InvokeInstaller Method Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/Runtimes.RuntimeInfo.md Executes a runtime installer located at a given file path. Typically used after downloading the installer. Supports quiet installation and logging. This is a virtual method. ```csharp public virtual Task InvokeInstaller(string pathToInstaller, bool isQuiet, IVelopackLogger log = null) ``` -------------------------------- ### MinVersion Property Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/Runtimes.VCRedistInfo.md Gets the minimum compatible version that must be installed for the VC++ redistributable. ```APIDOC ## MinVersion Property ### Description Gets the minimum compatible version that must be installed. ### Returns (Version) - The minimum compatible version. ``` -------------------------------- ### Velopack Setup.exe Usage Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cli/content/setup-windows.mdx This snippet shows the basic usage and command-line options for the Velopack setup.exe on Windows. Use this to understand how to install applications and configure the installation process. ```bash Velopack Setup (1.2.0) installs applications. https://velopack.io Usage: setup.exe [OPTIONS] [-- [EXE_ARGS]...] Arguments: [EXE_ARGS]... Arguments to pass to the started executable. Must be preceded by '--'. Options: -s, --silent Hides all dialogs and answers 'yes' to all prompts -v, --verbose Print debug messages to console -l, --log Enable file logging and set location -t, --installto Installation directory to install the application -h, --help Print help ``` -------------------------------- ### Customizing Windows Installer Arguments Source: https://github.com/velopack/velopack.docs/blob/master/docs/packaging/operating-systems/windows.mdx Shows how to use command-line arguments to customize the Windows installer, such as setting the package title, splash image, and icon. ```bash Setup.exe --packTitle "My App Title" --splashImage "path/to/splash.png" --icon "path/to/icon.ico" ``` -------------------------------- ### Start Method Signature Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack/UpdateExe.md Signature for the Start method, used to run Update.exe with the 'start' command. Optionally waits for a process to exit and passes arguments to the application. ```csharp public static void Start(IVelopackLocator? locator = null, uint waitPid = 0, string[]? startArgs = null) ``` -------------------------------- ### Register After Install Fast Callback Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/js/VelopackApp.md Registers a callback to be executed immediately after a successful installation. This hook is only supported on Windows and has a 30-second execution limit. ```javascript onAfterInstallFastCallback(callback: VelopackHook): VelopackApp ``` -------------------------------- ### Start New Process Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Locators/IProcessImpl.md Starts a new process with specified executable, arguments, working directory, and window visibility. ```csharp void StartProcess(string exePath, IEnumerable args, string workDir, bool showWindow) ``` -------------------------------- ### Install and Update .NET Tools Source: https://github.com/velopack/velopack.docs/blob/master/docs/contributing/compiling.mdx Installs or updates the `nbgv` tool to the latest version and installs the `dotnet-coverage` tool. These tools are required for versioning and code coverage during the build process. ```shell dotnet tool update -g nbgv dotnet tool install -g dotnet-coverage ``` -------------------------------- ### CurrentlyInstalledVersion Property Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Locators/OsxVelopackLocator.md Gets the currently installed version of the application, or null if the application is not installed. ```APIDOC ## CurrentlyInstalledVersion Property ### Description The currently installed version of the application, or null if the app is not installed. ### Method get ### Endpoint N/A ### Parameters None ### Request Example None ### Response #### Success Response (200) - **Value** (`SemanticVersion`?) - The currently installed version or null. ``` -------------------------------- ### Install vpk Command Line Tool Source: https://github.com/velopack/velopack.docs/blob/master/docs/getting-started/rust.mdx Install the Velopack packaging tool globally using the .NET Core SDK. Ensure .NET Core SDK 8 or later is installed. ```sh dotnet tool update -g vpk ``` -------------------------------- ### Set After Install Hook Callback Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cpp/c-api.md Sets a callback function to be executed immediately after the application is installed. This feature is only supported on Windows and has a 30-second execution limit. ```cpp void vpkc_app_set_hook_after_install(vpkc_hook_callback_t cb_after_install); ``` -------------------------------- ### Register After Install Hook in C++ Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cpp/VelopackApp.md Register a callback to be executed after the application is installed. This hook runs on Windows only and has a 30-second execution limit before termination. Returns a reference to the builder. ```cpp Velopack::VelopackApp& OnAfterInstall(vpkc_hook_callback_t cbAfterInstall); ``` -------------------------------- ### Start Local Development Server Source: https://github.com/velopack/velopack.docs/blob/master/README.md Launches a local development server with live reloading for real-time previewing. ```bash $ yarn start ``` -------------------------------- ### Shell Commands Example Source: https://github.com/velopack/velopack.docs/blob/master/AGENTS.md Example of shell command syntax highlighting. ```bash # Shell commands ``` -------------------------------- ### CurrentlyInstalledVersion Property Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Locators/WindowsVelopackLocator.md Gets the currently installed version of the application. ```APIDOC ## CurrentlyInstalledVersion ### Description The currently installed version of the application, or null if the app is not installed. ### Property - **CurrentlyInstalledVersion** (SemanticVersion?) - Read-only property. ``` -------------------------------- ### Install Multiple Dependencies Source: https://github.com/velopack/velopack.docs/blob/master/docs/packaging/bootstrapping.mdx Specify multiple dependencies using a comma-delimited list with the `--framework` argument. ```cmd vpk pack ... --framework net6.0-x64-desktop,vcredist142-x64 ``` -------------------------------- ### Install Specific .NET Version Source: https://github.com/velopack/velopack.docs/blob/master/docs/packaging/bootstrapping.mdx Specify a precise version of .NET, including patch version, for installation or upgrade. ```cmd --framework net6.0.11-x64-desktop ``` -------------------------------- ### EnsureInstalled Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack/UpdateManager.md Throws an exception if the current application is not installed. ```APIDOC ## EnsureInstalled() ### Description Throws an exception if the current application is not installed. ``` -------------------------------- ### Get a list of projects using vpk Source: https://github.com/velopack/velopack.docs/blob/master/docs/distributing/Flow/api.mdx Use the `vpk flow api` command with GET method to retrieve a list of all projects. ```bash vpk flow api -m GET -e "v1/projects/list" ``` -------------------------------- ### Get Current Version Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/py/UpdateManager.md Retrieves the version string of the currently installed application. ```python get_current_version() ``` -------------------------------- ### Get Current Version Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/js/UpdateManager.md Retrieves the version string of the currently installed application. ```typescript getCurrentVersion(): string ``` -------------------------------- ### Register After Install Fast Callback Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/py/App.md Registers a fast callback hook that executes immediately after an application installation on Windows. This is useful for quick post-installation tasks. ```python on_after_install_fast_callback(callback) ``` -------------------------------- ### Get Application ID Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/js/UpdateManager.md Retrieves the unique identifier of the currently installed application. ```typescript getAppId(): string ``` -------------------------------- ### Build and Serve Production Site Source: https://github.com/velopack/velopack.docs/blob/master/AGENTS.md Build the static site for production deployment and serve it locally to preview the final output. ```bash # Build for production npm run build # Serve production build locally npm run serve ``` -------------------------------- ### OnFirstRun(hook) Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack/VelopackApp.md Registers a hook that is triggered when the application is started for the first time after installation. ```APIDOC ## OnFirstRun(hook) ### Description Registers a hook that is triggered when the application is started for the first time after installation. ### Method `public VelopackApp OnFirstRun(VelopackHook hook)` ### Parameters #### Parameters - **hook** (`VelopackHook`) - Description: N/A ### Returns - `VelopackApp` ``` -------------------------------- ### Summary Property Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.NuGet/PackageManifest.md Gets the short summary of the package. ```csharp public string? Summary { get; } ``` -------------------------------- ### vpkc_app_set_hook_after_install Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cpp/c-api.md Sets a callback function to be executed after the application is installed. ```APIDOC ## Function `vpkc_app_set_hook_after_install` ### Description Sets a callback to be run after the app is installed. This hook is only supported on Windows and will be terminated if not completed within 30 seconds. ### Signature ```cpp void vpkc_app_set_hook_after_install(vpkc_hook_callback_t cb_after_install); ``` ### Parameters - **`cb_after_install`** (vpkc_hook_callback_t) - The callback to run after the app is installed. The callback takes a user data pointer and the version of the app as a string. ``` -------------------------------- ### VelopackApp::OnFirstRun Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cpp/VelopackApp.md Registers a hook that is triggered when the application is started for the first time after installation. ```APIDOC ## VelopackApp::OnFirstRun ### Description Registers a hook that is triggered when the application is started for the first time after installation. ### Method Instance method call ### Endpoint N/A (C++ class method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Parameters - **callback** (vpkc_hook_callback_t) - The callback function to execute on first run. ### Returns - A reference to the `VelopackApp` builder. ``` -------------------------------- ### Create a Release Package Source: https://github.com/velopack/velopack.docs/blob/master/docs/packaging/overview.mdx Compile your application and then use the `vpk pack` command with the necessary arguments to create a release package. Ensure your application is compiled first. ```bash dotnet publish -c Release -r win-x64 -o publish vpk pack --packId MyAppId --packVersion 1.0.0 --packDir publish --mainExe MyApp.exe ``` -------------------------------- ### StartProcess Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Locators/IProcessImpl.md Starts a new process with the specified executable path, arguments, and options. ```APIDOC ## StartProcess(exePath, args, workDir, showWindow) ### Description Starts a new process with the specified executable path, arguments, and options. ### Method ```cs void StartProcess(string exePath, IEnumerable args, string workDir, bool showWindow) ``` ### Parameters #### Path Parameters - **exePath** (string) - Required - The path to the executable to start. - **args** (IEnumerable) - Required - The command-line arguments to pass to the process. - **workDir** (string) - Required - The working directory for the new process. - **showWindow** (bool) - Required - Whether to show a window for the new process. ``` -------------------------------- ### StartProcess Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Locators/DefaultProcessImpl.md Starts a new process with the specified executable path, arguments, and options. ```APIDOC ## StartProcess(exePath, args, workDir, showWindow) ### Description Starts a new process with the specified executable path, arguments, and options. ### Parameters #### Path Parameters - **exePath** (string) - Required - The path to the executable to start. - **args** (IEnumerable) - Required - The command-line arguments to pass to the process. - **workDir** (string) - Optional - The working directory for the new process. - **showWindow** (bool) - Required - Whether to show a window for the new process. ``` -------------------------------- ### Get Current VelopackLocator Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Locators/VelopackLocator.md Access the process-wide VelopackLocator. This can be set or overridden during application setup. ```csharp public static IVelopackLocator Current { get; } ``` -------------------------------- ### Download, Pack, and Upload to S3 Source: https://github.com/velopack/velopack.docs/blob/master/docs/distributing/self-hosting.mdx This sequence demonstrates the basic workflow for self-hosting: downloading from S3, packaging your application, and then uploading the new release assets back to S3. Ensure you have the necessary AWS credentials and bucket configured. ```command-line vpk download s3 --bucket MyApp --region us-west-1 --keyId {keyId} --secret {secret} ``` ```command-line vpk pack -u YourAppId -v 1.0.1 -p {buildOutput} ``` ```command-line vpk upload s3 --bucket MyApp --region us-west-1 --keyId {keyId} --secret {secret} ``` -------------------------------- ### OnFirstRun Hook Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack/VelopackApp.md This hook is triggered when the application is started for the first time after installation. It accepts a VelopackHook delegate. ```csharp public VelopackApp OnFirstRun(VelopackHook hook) ``` -------------------------------- ### StartProcess Method Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Locators/DefaultProcessImpl.md Initiates a new process with specified parameters. Allows configuration of the executable path, arguments, working directory, and window visibility. ```csharp public void StartProcess(string exePath, IEnumerable args, string? workDir, bool showWindow) ``` -------------------------------- ### Update Server File Structure Example Source: https://github.com/velopack/velopack.docs/blob/master/docs/packaging/channels.mdx Illustrates the file structure on an update server when migrating a channel. This shows the canonical channel file and a copied file for legacy users. ```text releases.stable.json (points at v1.x.x win-x64 releases) ``` ```text releases.win-x64.json (v2.0.0 — the new canonical channel) releases.stable.json (a copy of releases.win-x64.json, so legacy "stable" users find v2.0.0) ``` -------------------------------- ### Accessing Application Paths at Runtime Source: https://github.com/velopack/velopack.docs/blob/master/docs/integrating/preserved-files.mdx Use VelopackLocator to get paths for application directories and metadata. This ensures your logic for storing files outside the install directory works across different platforms and install layouts. ```csharp VelopackApp.Build().Run(); // After Run() has executed, VelopackLocator.Current is available var locator = VelopackLocator.Current; // Example properties: var rootAppDir = locator.RootAppDir; // Application's root directory var appContentDir = locator.AppContentDir; // Versioned application files directory var packagesDir = locator.PackagesDir; // Downloaded packages directory var appTempDir = locator.AppTempDir; // Temporary/working directory var installedVersion = locator.CurrentlyInstalledVersion; var channel = locator.Channel; var isPortable = locator.IsPortable; ``` -------------------------------- ### Implement Basic Update Check Source: https://github.com/velopack/velopack.docs/blob/master/docs/getting-started/csharp.mdx This example demonstrates how to check for, download, and apply updates using `UpdateManager`. Ensure the URL points to your update feed. ```csharp 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); } ``` -------------------------------- ### Check for and Apply Updates Source: https://github.com/velopack/velopack.docs/blob/master/docs/getting-started/cpp.mdx This snippet demonstrates a basic update check, download, and application process. The URL points to your update host. Unlike other SDKs, the C/C++ library requires manual exit after preparing the update. ```cpp #include "Velopack.h" static void update_app() { Velopack::UpdateManager manager("https://the.place/you-host/updates"); auto updInfo = manager.CheckForUpdates(); if (!updInfo.has_value()) { return; // no updates available } // download the update, optionally providing progress callbacks manager.DownloadUpdates(updInfo.value()); // prepare the Updater in a new process, and wait 60 seconds for this process to exit manager.WaitExitThenApplyUpdate(updInfo.value()); exit(0); // exit the app to apply the update } ``` -------------------------------- ### run() Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/py/App.md Executes the core Velopack startup sequence and logic. ```APIDOC ## run() ### Description Executes the core Velopack startup sequence and logic. ### Code Example ```python App.run() ``` ``` -------------------------------- ### Root Application Directory Property Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Locators/VelopackLocator.md Gets the main directory where the application is installed. This may vary across operating systems. ```csharp public abstract string? RootAppDir { get; } ``` -------------------------------- ### Example Release Feed (releases.win.json) Source: https://github.com/velopack/velopack.docs/blob/master/docs/distributing/overview.mdx This JSON file lists all available releases and their associated assets. It's crucial for the UpdateManager to discover and download updates. Ensure this file accurately reflects the files available in the remote distribution folder. ```json { "Assets": [ { "PackageId": "YourAppId", "Version": "1.0.1", "Type": "Full", "FileName": "YourAppId-1.0.1-full.nupkg", "SHA1": "537EC0F4E1C4263A230353FAB4150216E5AF3724", "Size": 1588612 }, { "PackageId": "YourAppId", "Version": "1.0.1", "Type": "Delta", "FileName": "YourAppId-1.0.1-delta.nupkg", "SHA1": "9615D266DDBCADF3B9CD82BABF9DA571A0EE2B83", "Size": 3606 }, { "PackageId": "YourAppId", "Version": "1.0.0", "Type": "Full", "FileName": "YourAppId-1.0.0-full.nupkg", "SHA1": "69122BABCEEEF9F653BFE59D87DDAEF363F9476F", "Size": 1588613 } ] } ``` -------------------------------- ### VCRedist00 DownloadUrl Property Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/Runtimes.VCRedist00.md Gets the permalink to the installer for this VC++ runtime redistributable. This property provides direct access to the download URL. ```csharp public string DownloadUrl { get; } ``` -------------------------------- ### BaseRelease Property Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack/UpdateInfo.md Gets the base release for applying delta updates. If null, the currently installed version may be used as the base. ```csharp public VelopackAsset? BaseRelease { get; } ``` -------------------------------- ### Publish Application with Dotnet CLI Source: https://github.com/velopack/velopack.docs/blob/master/docs/distributing/github-actions.mdx Compiles and publishes the application using 'dotnet publish'. This example configures it for a self-contained release on Windows x64, outputting to a 'publish' directory. Adapt runtime, self-contained flag, and output path as needed. ```bash - name: Publish Application run: dotnet publish MyProject/MyProject.csproj -c Release -o publish -r win-x64 --self-contained true ``` -------------------------------- ### Register First Run Hook in C++ Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cpp/VelopackApp.md Register a callback to be executed when the application is started for the first time after installation. Returns a reference to the builder. ```cpp Velopack::VelopackApp& OnFirstRun(vpkc_hook_callback_t cbFirstRun); ``` -------------------------------- ### Open Shortcut from File Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/ShellLink.md Loads a shortcut from the specified file path. ```cs public void Open(string linkFile) ``` -------------------------------- ### Get Application ID Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cpp/UpdateManager.md Returns the unique identifier for the currently installed application. This ID is crucial for Velopack to manage updates specific to this application. ```cpp std::string GetAppId() noexcept; ``` -------------------------------- ### Register First Run Hook Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/py/App.md Registers a hook that is triggered only when the application is launched for the very first time after a fresh installation. This is suitable for one-time setup routines. ```python on_first_run(callback) ``` -------------------------------- ### Get Current Application Version Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cpp/UpdateManager.md Retrieves the version string of the currently installed application. This is useful for displaying version information to the user or for comparison with available updates. ```cpp std::string GetCurrentVersion() noexcept; ``` -------------------------------- ### Download and Pack Release with HTTP Source Source: https://github.com/velopack/velopack.docs/blob/master/docs/distributing/deploy-cli.mdx Use the `vpk download` command with an HTTP source to fetch the latest release, followed by `vpk pack` to package your new version. This is useful for setting up delta updates. ```cmd vpk download http --url https://the.place/you-host/updates vpk pack -u YourAppId -v 1.0.1 -p {buildOutput} ``` -------------------------------- ### Get Current App Version (C API) Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cpp/c-api.md Retrieves the currently installed application version. Ensure a valid update manager instance and a sufficiently sized buffer are provided. ```cpp size_t vpkc_get_current_version(vpkc_update_manager_t* p_manager, char* psz_version, size_t c_version); ``` -------------------------------- ### VPK Download GitHub Command Help Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cli/content/vpk-windows.mdx Shows detailed options for downloading the latest release from a GitHub repository. Includes parameters for output directory, release channel, repository URL, authentication token, network timeout, and pre-release selection. ```bash vpk download github -H ``` -------------------------------- ### Get or Create Staged User ID Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Locators/IVelopackLocator.md Retrieves a unique GUID for the current user, used to determine eligibility for staged rollouts. If no ID exists, a new one is generated and returned. ```csharp Guid? GetOrCreateStagedUserId() ``` -------------------------------- ### Example Output Directory Structure Source: https://github.com/velopack/velopack.docs/blob/master/docs/distributing/overview.mdx This shows the typical files generated in the output directory after a Velopack release. It includes nupkg files, setup executables, portable versions, and release feed files. ```text Releases ├── YourAppId-1.0.1-full.nupkg ├── YourAppId-1.0.1-delta.nupkg ├── YourAppId-Setup.exe ├── YourAppId-Portable.zip ├── releases.{channel}.json ├── assets.{channel}.json └── RELEASES ``` -------------------------------- ### Create a new project using vpk Source: https://github.com/velopack/velopack.docs/blob/master/docs/distributing/Flow/api.mdx Use the `vpk flow api` command with POST method and a JSON body to create a new project. ```bash vpk flow api -m POST -e "v1/projects/create" -b '{"name": "My Project Name", "teamIdentifier": "Default Team", "packageId": "company.package.id"}' ``` -------------------------------- ### vpk pack Command Help Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cli/content/vpk-windows.mdx Provides detailed help for the 'vpk pack' command, outlining options for creating application release packages. ```bash Description: Creates a release from a folder containing application files. Usage: vpk pack [options] Options: --outputDir, -o, --outputDir ENV=VPK_OUTPUT_DIR Output directory for created packages. [default: Releases] --channel, -c, --channel ENV=VPK_CHANNEL The channel to use for this release. [default: win] --runtime, -r, --runtime ENV=VPK_RUNTIME The target runtime to build packages for. --packId, --packId, -u (REQ) ENV=VPK_PACK_ID Unique Id for application bundle. --packVersion, --packVersion, -v ENV=VPK_PACK_VERSION Current (REQ) version for application bundle. --packDir, --packDir, -p ENV=VPK_PACK_DIR Directory (REQ) containing application files for release. --packAuthors, --packAuthors ENV=VPK_PACK_AUTHORS Company name or comma-delimited list of authors. --packTitle, --packTitle ENV=VPK_PACK_TITLE Display/friendly name for application. --releaseNotes, --releaseNotes ENV=VPK_RELEASE_NOTES File with markdown-formatted notes for this version. --delta, --delta ENV=VPK_DELTA Disable or set the delta generation mode. [default: BestSpeed] --icon, -i, --icon ENV=VPK_ICON Path to icon file for package. --mainExe, -e, --mainExe ENV=VPK_MAIN_EXE The file name (not path) of the main/entry executable. --exclude, --exclude ENV=VPK_EXCLUDE A regex which excludes matched files from the package (in addition to built-in defaults). [default: .* .pdb] --noDefaultExclude, ENV=VPK_NO_DEFAULT_EXCLUDE Do not --noDefaultExclude exclude built-in default file patterns (eg. .nupkg, createdump, .vshost.). [default: False] --noPortable, --noPortable ENV=VPK_NO_PORTABLE Skip generating a portable bundle. [default: False] --noInst, --noInst ENV=VPK_NO_INST Skip generating an installer package. [default: False] ``` -------------------------------- ### Ensure Application is Installed Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack/UpdateManager.md Checks if the application is currently installed. Throws an exception if it's not, preventing operations that require an installed application. ```cs protected virtual void EnsureInstalled() ``` -------------------------------- ### Open (string, nint, EShellLinkResolveFlags, ushort) Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/ShellLink.md Loads a shortcut from the specified file, with options to control UI behavior and a timeout if no UI is displayed. ```APIDOC ## Open(linkFile, hWnd, resolveFlags, timeOut) ### Description Loads a shortcut from the specified file, and allows flags controlling the UI behaviour if the shortcut's target isn't found to be set. If no SLR_NO_UI is specified, you can also specify a timeout. ### Method `public void Open(string linkFile, nint hWnd, ShellLink.EShellLinkResolveFlags resolveFlags, ushort timeOut)` ### Parameters #### Path Parameters - **linkFile** (string) - Required - The shortcut file (.lnk) to load. - **hWnd** (nint) - Required - The window handle of the application's UI, if any. - **resolveFlags** (ShellLink.EShellLinkResolveFlags) - Required - Flags controlling resolution behaviour. - **timeOut** (ushort) - Required - Timeout if SLR_NO_UI is specified, in ms. ### Returns None ``` -------------------------------- ### DownloadToFile Method Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/Runtimes.RuntimeInfo.md Asynchronously downloads the latest installer for this runtime to a specified local file path. Supports progress reporting and custom downloaders/loggers. This is a virtual method. ```csharp public virtual Task DownloadToFile(string localPath, Action progress = null, IFileDownloader downloader = null, IVelopackLogger log = null) ``` -------------------------------- ### Create PropVariant from Guid Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/ShellLink.PropVariant.md Use this method to create a PropVariant instance from a Guid value. This is useful for representing GUIDs within the PropVariant structure. ```csharp public static ShellLink.PropVariant FromGuid(Guid guid) ``` -------------------------------- ### Silent Installation Source: https://github.com/velopack/velopack.docs/blob/master/docs/packaging/operating-systems/windows.mdx Explains how to perform a silent installation of a Velopack application, preventing the application from launching automatically after installation, using the '--silent' argument. ```bash Setup.exe --silent ``` -------------------------------- ### All Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/Runtimes.md Provides an array containing information for all currently supported runtimes. ```APIDOC ## All ### Description An array of all the currently supported runtimes. ### Code ```cs public static readonly Runtimes.RuntimeInfo[] All ``` ``` -------------------------------- ### Windows MSI Install Location Override Source: https://github.com/velopack/velopack.docs/blob/master/docs/packaging/installer.mdx Administrators can override the default install location for MSI packages by setting the VELOPACK_INSTALLDIR property during installation with msiexec. ```cmd msiexec /i MyApp.msi /qn VELOPACK_INSTALLDIR="D:\Apps\MyApp" ``` -------------------------------- ### VPK Download Command Help Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cli/content/vpk-windows.mdx Displays general help information for the 'vpk download' command, listing available subcommands for different download sources. ```bash vpk download -H ``` -------------------------------- ### VPK CLI Upload Local Command Help Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cli/content/vpk-windows.mdx Displays help information for the 'vpk upload local' command, detailing its purpose, usage, and available options for uploading releases to a local path or network share. ```bash Description: Upload releases to a local path or network share. Usage: vpk upload local [options] Options: --outputDir, -o, --outputDir ENV=VPK_OUTPUT_DIR Output (REQ) directory for created packages. [default: Releases] --channel, -c, --channel ENV=VPK_CHANNEL The channel to use for this release. [default: win] --path, --path (REQ) ENV=VPK_PATH Target file path to copy releases to/from. --keepMaxReleases, ENV=VPK_KEEP_MAX_RELEASES The --keepMaxReleases maximum number of releases to keep in the target directory, anything older will be deleted. --regenerate, --regenerate ENV=VPK_REGENERATE Force regenerate the releases.{channel}.json file in the target directory. [default: False] ``` -------------------------------- ### FrameworkInfo Constructor Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/Runtimes.FrameworkInfo.md Initializes a new instance of the FrameworkInfo class with the specified ID, display name, download URL, and release version. ```csharp public FrameworkInfo(string id, string displayName, string downloadUrl, int releaseVersion) ``` -------------------------------- ### Velopack Initialization with Customization Source: https://github.com/velopack/velopack.docs/blob/master/docs/integrating/overview.mdx Integrate Velopack with custom logging and callbacks for specific events like uninstallation or first run. This example demonstrates setting a logger and defining actions for OnBeforeUninstallFastCallback and OnFirstRun. ```cs static void Main(string[] args) { IVelopackLogger log = CreateLogger(); VelopackApp.Build() .SetLogger(log) .OnBeforeUninstallFastCallback((v) => { // delete / clean up some files before uninstallation }) .OnFirstRun((v) => { MessageBox.Show("Thanks for installing my application!"); }) .Run(); } ``` -------------------------------- ### FrameworkInfo Constructor Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/Runtimes.FrameworkInfo.md Initializes a new instance of the FrameworkInfo class with the specified ID, display name, download URL, and release version. ```APIDOC ## FrameworkInfo Constructor ### Description Initializes a new instance of the FrameworkInfo class. ### Parameters #### Parameters - **id** (string) - Description - **displayName** (string) - Description - **downloadUrl** (string) - Description - **releaseVersion** (int) - Description ``` -------------------------------- ### SetToastActivatorCLSID (Guid) Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/ShellLink.md Sets the CLSID for the Toast Activator using a Guid. ```APIDOC ## SetToastActivatorCLSID(clsid) ### Description Sets the ToastActivatorCLSID. ### Method `public void SetToastActivatorCLSID(Guid clsid)` ### Parameters #### Path Parameters - **clsid** (Guid) - Required - The CLSID of the Toast Activator. ### Returns None ``` -------------------------------- ### on_after_install_fast_callback(callback) Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/py/App.md Registers a fast callback hook that is triggered after a successful installation. This is specific to Windows environments. ```APIDOC ## on_after_install_fast_callback(callback) ### Description Registers a fast callback hook that is triggered after a successful installation. This is specific to Windows environments. ### Parameters * `callback` - The function to be called after installation. ### Code Example ```python App.on_after_install_fast_callback(my_callback_function) ``` ``` -------------------------------- ### SetToastActivatorCLSID (Guid) Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/ShellLink.md Sets the CLSID for the ToastActivator using a Guid structure. ```cs public void SetToastActivatorCLSID(Guid clsid) ``` -------------------------------- ### Initialize SimpleWebSource Source: https://github.com/velopack/velopack.docs/blob/master/docs/integrating/update-sources.mdx Creates a SimpleWebSource to read release feeds over HTTP(S) from a static location. ```cs new SimpleWebSource("https://the.place/you-host/updates"); ``` -------------------------------- ### C# Code Example Source: https://github.com/velopack/velopack.docs/blob/master/AGENTS.md Example of C# code syntax highlighting. ```csharp // C# code example ``` -------------------------------- ### on_first_run(callback) Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/py/App.md Registers a callback that is invoked the very first time the application is launched after its installation. ```APIDOC ## on_first_run(callback) ### Description Registers a callback that is invoked the very first time the application is launched after its installation. ### Parameters * `callback` - The function to execute on the first run. ### Code Example ```python App.on_first_run(my_callback_function) ``` ``` -------------------------------- ### CreateShortcutForThisExe Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/Shortcuts.md Creates a shortcut to the currently running executable. By default, shortcuts are created on the Desktop and in the Start Menu root. This method is an alternative to the now-automatic shortcut creation during installation/uninstallation. ```APIDOC ## CreateShortcutForThisExe(location) ### Description Creates a shortcut to the currently running executable at the specified locations. This method is provided as a helper and is an alternative to the automatic shortcut creation that now occurs during application installation and uninstallation. ### Parameters #### Path Parameters - **location** (`ShortcutLocation`) - Optional - Specifies where to create the shortcut. Defaults to `ShortcutLocation.Desktop | ShortcutLocation.StartMenuRoot`. ``` -------------------------------- ### Initialize SimpleFileSource Source: https://github.com/velopack/velopack.docs/blob/master/docs/integrating/update-sources.mdx Creates a SimpleFileSource to read release feeds from a local directory. Useful for testing or network shares. ```cs new SimpleFileSource(new DirectoryInfo(@"C:\my-updates")); ``` -------------------------------- ### CurrentVersion Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack/UpdateManager.md The currently installed application version. Null if the app is not currently installed. ```APIDOC ## CurrentVersion ### Description The currently installed app version when you created your release. Null if this is not a currently installed app. ### Property `public virtual SemanticVersion? CurrentVersion { get; }` ``` -------------------------------- ### GetDownloadUrl Method Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/Runtimes.RuntimeInfo.md Asynchronously retrieves the web URL for the latest compatible runtime installer executable. This is an abstract method. ```csharp public abstract Task GetDownloadUrl() ``` -------------------------------- ### CurrentlyInstalledVersion Property Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Locators/LinuxVelopackLocator.md Retrieves the currently installed version of the application, or null if not installed. ```csharp public override SemanticVersion? CurrentlyInstalledVersion { get; } ``` -------------------------------- ### CurrentVersion Property Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack/UpdateManager.md The version of the currently installed application. This is null if the app is not currently installed. ```csharp public virtual SemanticVersion? CurrentVersion { get; } ``` -------------------------------- ### Download, Pack, and Upload Release with AWS S3 Source: https://github.com/velopack/velopack.docs/blob/master/docs/distributing/deploy-cli.mdx This snippet demonstrates deploying a release using AWS S3. It includes downloading from S3, packing the application, and uploading the release artifacts. Authentication can be done via access keys or environment variables. ```cmd vpk download s3 --bucket MyApp --region us-west-1 --keyId {accessKeyId} --secret {accessKeySecret} vpk pack -u YourAppId -v 1.0.1 -p {buildOutput} vpk upload s3 --bucket MyApp --region us-west-1 --keyId {accessKeyId} --secret {accessKeySecret} ``` -------------------------------- ### Open (string) Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/ShellLink.md Loads a shortcut from the specified file path. ```APIDOC ## Open(linkFile) ### Description Loads a shortcut from the specified file. ### Method `public void Open(string linkFile)` ### Parameters #### Path Parameters - **linkFile** (string) - Required - The shortcut file (.lnk) to load. ### Returns None ``` -------------------------------- ### CurrentlyInstalledVersion Property Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Locators/IVelopackLocator.md Retrieves the SemanticVersion of the currently installed application, or null if the application is not installed. This property is read-only. ```csharp SemanticVersion? CurrentlyInstalledVersion { get; } ``` -------------------------------- ### Install Velopack Python Package Source: https://github.com/velopack/velopack.docs/blob/master/docs/getting-started/python.mdx Install the Velopack library using pip. This command should be run in your project's environment. ```txt pip install velopack ``` -------------------------------- ### Publish and Pack Application with Velopack Source: https://github.com/velopack/velopack.docs/blob/master/docs/migrating/squirrel.mdx Publish your application using `dotnet publish` and then package the output using `vpk pack`. Ensure the output directory and main executable are correctly specified. ```cmd dotnet publish --self-contained -r win-x64 -o publish vpk pack -u YourAppId -v 1.0.0 -p publish -e yourMainBinary.exe ``` -------------------------------- ### Equivalent UpdateManager Constructors Source: https://github.com/velopack/velopack.docs/blob/master/docs/integrating/update-sources.mdx Demonstrates two equivalent ways to initialize an UpdateManager with a web source. ```cs // these two are equivalent var mgr = new UpdateManager("https://the.place/you-host/updates"); var mgr = new UpdateManager(new SimpleWebSource("https://the.place/you-host/updates")); ``` -------------------------------- ### AllowVersionDowngrade Property Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack/UpdateOptions.md Configures whether the UpdateManager can install a lower version than the currently installed one. Useful for rollbacks or channel switching. ```csharp public bool AllowVersionDowngrade { get; set; } ``` -------------------------------- ### Get PKEY_AppUserModel_ToastActivatorCLSID Property Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/ShellLink.PROPERTYKEY.md Retrieves the static PKEY_AppUserModel_ToastActivatorCLSID property of the ShellLink.PROPERTYKEY struct. This property is used to get the CLSID of the toast activator. ```csharp public static ShellLink.PROPERTYKEY PKEY_AppUserModel_ToastActivatorCLSID { get; } ``` -------------------------------- ### Run() Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack/VelopackApp.md Executes the Velopack application startup sequence and invokes any registered hooks. ```APIDOC ## Run() ### Description Executes the Velopack application startup sequence and invokes any registered hooks. ### Method `public void Run()` ### Returns - `void` ``` -------------------------------- ### Pack Application for Release Source: https://github.com/velopack/velopack.docs/blob/master/docs/getting-started/content/_build-release.mdx Use this command to package your application for release. Specify a unique `--packId`, the `--packVersion`, the output directory with `--packDir`, and optionally the `--mainExe` if it differs from the pack ID. ```cmd vpk pack --packId YourAppId --packVersion 1.0.0 --packDir .\publish --mainExe yourMainApp.exe ``` -------------------------------- ### Open (string, nint, EShellLinkResolveFlags) Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack.Windows/ShellLink.md Loads a shortcut from the specified file, with options to control UI behavior if the target is not found. ```APIDOC ## Open(linkFile, hWnd, resolveFlags) ### Description Loads a shortcut from the specified file, and allows flags controlling the UI behaviour if the shortcut's target isn't found to be set. ### Method `public void Open(string linkFile, nint hWnd, ShellLink.EShellLinkResolveFlags resolveFlags)` ### Parameters #### Path Parameters - **linkFile** (string) - Required - The shortcut file (.lnk) to load. - **hWnd** (nint) - Required - The window handle of the application's UI, if any. - **resolveFlags** (ShellLink.EShellLinkResolveFlags) - Required - Flags controlling resolution behaviour. ### Returns None ``` -------------------------------- ### Download, Pack, and Upload to GitHub Source: https://github.com/velopack/velopack.docs/blob/master/docs/distributing/self-hosting.mdx Commands to download a release from GitHub, pack a new version of your application, and upload it as a published release. A token is required for private repositories. ```cmd vpk download github --repoUrl https://github.com/me/MyApp --token {token} vpk pack -u YourAppId -v 1.0.1 -p {buildOutput} vpk upload github --repoUrl https://github.com/me/MyApp --token {token} --publish --tag v1.0.1 ``` -------------------------------- ### Basic Update Process Source: https://github.com/velopack/velopack.docs/blob/master/docs/integrating/overview.mdx This snippet shows the fundamental steps for checking, downloading, and applying updates using UpdateManager. ```cs 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); } ``` -------------------------------- ### Mock Velopack Installation with TestVelopackLocator Source: https://github.com/velopack/velopack.docs/blob/master/docs/integrating/testing.mdx Use TestVelopackLocator to mock a Velopack installation for testing purposes. This is useful for simulating app ID, version, and package directory. ```csharp var locator = new TestVelopackLocator( appId: "MyApp", version: "1.0.0", packagesDir: "/path/to/packages" ); VelopackApp.Build() .SetLocator(locator) .Run(); ``` -------------------------------- ### Velopack Startup Housekeeping Source: https://github.com/velopack/velopack.docs/blob/master/docs/integrating/overview.mdx On every launch, VelopackApp.Build().Run() performs auto-apply of newer full packages and cleans up old local packages. ```csharp VelopackApp.Build().Run(); ``` -------------------------------- ### Initialize Velopack Application Source: https://github.com/velopack/velopack.docs/blob/master/docs/getting-started/cpp.mdx Add `VelopackApp` to your entry point as early as possible. This should ideally be the first statement to run, as Velopack may exit or restart the app at this point. ```cpp #include "Velopack.h" int wmain(int argc, wchar_t* argv[], wchar_t* envp[]) { // This should run as early as possible in the main method. // Velopack may exit / restart the app at this point. // See VelopackApp class for more options/configuration. Velopack::VelopackApp::Build().Run(); // ... your other startup code here } ``` -------------------------------- ### Run Method Source: https://github.com/velopack/velopack.docs/blob/master/docs/reference/cs/Velopack/VelopackApp.md Runs the Velopack application startup code and triggers any configured hooks. ```csharp public void Run() ```