Skip to content

Fill package dir with init app version when .msi file used #66

Description

@stredula-firstis

Description

When an application is installed via the Velopack-generated MSI installer, the packages/ directory inside the install folder is never created or seeded with the current version's {packId}-{version}-full.nupkg. This prevents delta updates from working for the first update after MSI installation, because Velopack has no local base package to apply the delta patch against.

This is inconsistent with the documentation, which states:

"After installation, updates work identically via Update.exe regardless of whether the app was installed with Setup.exe or the .msi."

In practice, delta updates only work identically from the second update onward when using MSI.


Steps to Reproduce

  1. Build a release with vpk pack --msi (e.g. version 2.0.0).
  2. Install the application using the generated .msi file.
  3. Inspect the install directory — the packages/ subfolder is absent (or empty).
  4. Build and deploy a new release (e.g. version 2.0.1) including a delta package.
  5. Launch the installed application and trigger an update check.
  6. Observe that Velopack downloads the full 2.0.1-full.nupkg instead of the smaller 2.0.1-delta.nupkg.
  7. After the update completes, inspect the packages/ folder — it now contains {packId}-2.0.1-full.nupkg.
  8. Deploy version 2.0.2 and trigger another update — delta now works correctly, because the 2.0.1 base package is present.

Expected Behavior

The MSI installer should seed the packages/ folder with the current version's full.nupkg during installation (the same way Setup.exe does), so that delta updates work correctly starting from the very first update.


Actual Behavior

  • After MSI installation, the packages/ directory does not exist or is empty.
  • The first update is always a full download, regardless of whether a delta package is available on the server.
  • Subsequent updates work correctly (delta is applied using the previously stored full package).

Environment

  • OS: Windows 11
  • App framework: .NET 10 MAUI Desktop Win
  • Velopack version: 1.2.0
  • MSI install location: PerUser (%LocalAppData%\{packId})

Root Cause Analysis

When Setup.exe installs the application, it:

  1. Extracts the embedded nupkg.
  2. Deploys app files to current/.
  3. Stores {packId}-{version}-full.nupkg in the packages/ folder as a reference for future delta reconstruction.

When the MSI installs the application, it:

  1. Deploys app files to {installDir}/current/ via Windows Installer.
  2. Deploys Update.exe.
  3. Does not create or populate the packages/ folder — the nupkg is not part of the WiX-generated file layout.

As a result, Update.exe cannot find a local base package and falls back to downloading the full release.


Suggested Fix

The MSI build process (WiX 5 generation) should include the current version's full.nupkg as an installed file in {installDir}\packages\{packId}-{version}-full.nupkg, mirroring what Setup.exe does at install time.

Alternatively, Update.exe could be invoked as a custom action at the end of the MSI installation to perform the same post-install bootstrap that Setup.exe currently performs.


Workaround

As a temporary workaround, the application can detect first run (empty/missing packages/ folder) and silently download the current version's full.nupkg from the update server in the background using WithFirstRun(...) hook:

VelopackApp.Build()
    .WithFirstRun(version =>
    {
        _ = Task.Run(() => BootstrapPackagesCacheAsync(version));
    })
    .Run();

This is not ideal as it downloads the full package (potentially large) silently on first launch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions