Skip to content

Commit

Permalink
Include framework packages during installed packages enumeration (#3975)
Browse files Browse the repository at this point in the history
  • Loading branch information
yao-msft committed Dec 14, 2023
1 parent 4dc7647 commit a1a1446
Showing 1 changed file with 18 additions and 5 deletions.
Expand Up @@ -74,7 +74,7 @@ namespace AppInstaller::Repository::Microsoft
else
{
// TODO: Consider if Optional packages should also be enumerated
packages = packageManager.FindPackagesForUserWithPackageTypes({}, PackageTypes::Main);
packages = packageManager.FindPackagesForUserWithPackageTypes({}, PackageTypes::Main | PackageTypes::Framework);
}

// Reuse the same manifest object, as we will be setting the same values every time.
Expand Down Expand Up @@ -157,11 +157,24 @@ namespace AppInstaller::Repository::Microsoft

manifest.Installers[0].PackageFamilyName = familyName;

// Use the full name as a unique key for the path
auto manifestId = index.AddManifest(manifest, std::filesystem::path{ packageId.FullName().c_str() });
try
{
// Use the full name as a unique key for the path
auto manifestId = index.AddManifest(manifest, std::filesystem::path{ packageId.FullName().c_str() });

index.SetMetadataByManifestId(manifestId, PackageVersionMetadata::InstalledType,
Manifest::InstallerTypeToString(Manifest::InstallerTypeEnum::Msix));
index.SetMetadataByManifestId(manifestId, PackageVersionMetadata::InstalledType,
Manifest::InstallerTypeToString(Manifest::InstallerTypeEnum::Msix));
}
catch (const wil::ResultException& resultException)
{
if (HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS) == resultException.GetErrorCode() && package.IsFramework())
{
// There may be multiple packages with same package family name for framework packages.
continue;
}

throw;
}
}
}

Expand Down

0 comments on commit a1a1446

Please sign in to comment.