Skip to content

Commit

Permalink
Installer should FindPackages By FamilyName that are of Main and Fram…
Browse files Browse the repository at this point in the history
…ework PackageTypes ONLY.
  • Loading branch information
Santosh Chintalapati committed Sep 30, 2022
1 parent 9d287d5 commit df46662
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 4 additions & 6 deletions installer/dev/install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ namespace WindowsAppRuntimeInstaller
// Check if a higher version of the package is already installed.
PackageManager packageManager;
winrt::hstring currentUserSID;
const auto installedPackages = packageManager.FindPackagesForUser(currentUserSID, packageProperties->familyName.get());
auto installedPackages{ packageManager.FindPackagesForUserWithPackageTypes(currentUserSID, packageProperties->familyName.get(),
::Windows::Management::Deployment::PackageTypes::Framework |
::Windows::Management::Deployment::PackageTypes::Main) };
bool isPackageInstalledAndIsPackageStatusOK{};

// installedPackages can contain only one version of the packagefamily across all servicing revisions of a WindowsAppSDK version.
Expand All @@ -291,11 +293,7 @@ namespace WindowsAppRuntimeInstaller
// For the already installed package of same WindowsAppSDK Major.Minor version with matching architecture, compare version
if (installedPackage.Id().Architecture() == packageProperties->architecture)
{
UINT64 installedPackageVersion = ((static_cast<UINT64>(installedPackage.Id().Version().Major) << 48) +
(static_cast<UINT64>(installedPackage.Id().Version().Minor) << 32) +
(static_cast<UINT64>(installedPackage.Id().Version().Build) << 16) +
static_cast<UINT64>(installedPackage.Id().Version().Revision));

const auto installedPackageVersion{ AppModel::Package::ToPackageVersion(installedPackage.Id().Version()).Version };
if (installedPackageVersion > packageProperties->version)
{
installActivityContext.SetExistingPackageIfHigherVersion(installedPackage.Id().FullName());
Expand Down
1 change: 1 addition & 0 deletions installer/dev/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <Security.IntegrityLevel.h>
#include <Security.User.h>
#include <PushNotifications-Constants.h>
#include <AppModel.Package.h>

#include "tracelogging.h"
#include "InstallActivityContext.h"
Expand Down

0 comments on commit df46662

Please sign in to comment.