Hello @Halifax Crosby ,
Yes—this is supported when your WinForms app is MSIX‑packaged and runs with package identity (installed from the Microsoft Store or sideloaded as MSIX). Use the WinRT Windows.Services.Store APIs, specifically StoreContext, to check for updates, download them, and then let Windows prompt the user to install.
What you need
- MSIX packaging.
- Add
Microsoft.Windows.SDK.Contracts(NuGet) so your .NET Framework app can call WinRT APIs. - Target Windows 10, version 1607 (build 14393) or later (recommend 1809+).
- In desktop apps, initialize
StoreContextwith your window handle and call update methods on the UI thread.
A minimal flow should look like this
using Windows.Services.Store;
using WinRT.Interop; // InitializeWithWindow, WindowNative
// e.g., inside your main Form
private StoreContext _store;
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
_store = StoreContext.GetDefault();
InitializeWithWindow.Initialize(_store, WindowNative.GetWindowHandle(this)); // bind UI
}
private async void btnUpdate_Click(object sender, EventArgs e)
{
var updates = await _store.GetAppAndOptionalStorePackageUpdatesAsync();
if (updates.Count == 0)
{
MessageBox.Show("No updates available.");
return;
}
// Optional: background download first
// await _store.RequestDownloadStorePackageUpdatesAsync(updates).AsTask();
// Save state, then request install (Windows shows a consent dialog)
var result = await _store.RequestDownloadAndInstallStorePackageUpdatesAsync(updates).AsTask();
// The app will normally close for install. Inspect result.OverallState for status.
}
Restart behavior
- Updates typically close your app to install. If you need it to relaunch automatically, call
RegisterApplicationRestartbefore triggering install.
I hope this helps.