Forum Discussion

szilardd's avatar
szilardd
Brass Contributor
Nov 25, 2021
Solved

Application crash on Windows 10 Enterprise LTSC when using AppInstaller

I have a .NET Windows Forms app packaged with MSIX and Automatic Updates configured using the AppInstaller feature.   It works fine on Windows 10 Professional edition, but my target version is Wind...
  • szilardd's avatar
    szilardd
    Dec 01, 2021

    I got it working using the `Microsoft.Windows.SDK.Contracts` NuGet package instead of the approach described above (had to convert from package.config to PackageReference)

    https://docs.microsoft.com/en-us/windows/apps/desktop/modernize/desktop-to-uwp-enhance#earlier-versions-of-net-install-the-microsoftwindowssdkcontracts-nuget-package

    Sample code

     

    var packageManager = new PackageManager();
    var currentPackage = packageManager.FindPackageForUser(string.Empty, Package.Current.Id.FullName);
    var result = await currentPackage.CheckUpdateAvailabilityAsync();
    
    if (result.ExtendedError != null) {
        LogError("Update availability error", result.ExtendedError);
    }
    
    var hasUpdate = (result.Availability == PackageUpdateAvailability.Available);
    
    if (hasUpdate) {
        // there is an update available
    }

     



Resources