Skip to content

Commit df46662

Browse files
author
Santosh Chintalapati
committed
Installer should FindPackages By FamilyName that are of Main and Framework PackageTypes ONLY.
1 parent 9d287d5 commit df46662

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

installer/dev/install.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,9 @@ namespace WindowsAppRuntimeInstaller
281281
// Check if a higher version of the package is already installed.
282282
PackageManager packageManager;
283283
winrt::hstring currentUserSID;
284-
const auto installedPackages = packageManager.FindPackagesForUser(currentUserSID, packageProperties->familyName.get());
284+
auto installedPackages{ packageManager.FindPackagesForUserWithPackageTypes(currentUserSID, packageProperties->familyName.get(),
285+
::Windows::Management::Deployment::PackageTypes::Framework |
286+
::Windows::Management::Deployment::PackageTypes::Main) };
285287
bool isPackageInstalledAndIsPackageStatusOK{};
286288

287289
// installedPackages can contain only one version of the packagefamily across all servicing revisions of a WindowsAppSDK version.
@@ -291,11 +293,7 @@ namespace WindowsAppRuntimeInstaller
291293
// For the already installed package of same WindowsAppSDK Major.Minor version with matching architecture, compare version
292294
if (installedPackage.Id().Architecture() == packageProperties->architecture)
293295
{
294-
UINT64 installedPackageVersion = ((static_cast<UINT64>(installedPackage.Id().Version().Major) << 48) +
295-
(static_cast<UINT64>(installedPackage.Id().Version().Minor) << 32) +
296-
(static_cast<UINT64>(installedPackage.Id().Version().Build) << 16) +
297-
static_cast<UINT64>(installedPackage.Id().Version().Revision));
298-
296+
const auto installedPackageVersion{ AppModel::Package::ToPackageVersion(installedPackage.Id().Version()).Version };
299297
if (installedPackageVersion > packageProperties->version)
300298
{
301299
installActivityContext.SetExistingPackageIfHigherVersion(installedPackage.Id().FullName());

installer/dev/pch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <Security.IntegrityLevel.h>
3333
#include <Security.User.h>
3434
#include <PushNotifications-Constants.h>
35+
#include <AppModel.Package.h>
3536

3637
#include "tracelogging.h"
3738
#include "InstallActivityContext.h"

0 commit comments

Comments
 (0)